Printing with MPTPrinter

0

Good morning, I need to make an impression using MPTPrinter. But this impression needs to have a certain alignment, for example the values need to be printed from right to left. However when I use the setHorizontalAlignment (Control.RIGHT) command it is fully aligned to the right of the paper, and I need to print 3 information aligned from straight to left on the same line (Values information). I would like to know how to do this type of alignment, which commands can I use?

Follow the test code (just a test of the printout of the order items).

protected void imprimirItensNota(NotaFiscal nota){
    try {

        mPrinter.setFont(true, false, false, false);

        mPrinter.setXPos(1);
        mPrinter.print("Produto");

        mPrinter.setXPos(270);
        mPrinter.print("Qtde.");

        mPrinter.setXPos(360);
        mPrinter.print("Unit.");

        mPrinter.setXPos(440);
        mPrinter.print("Desc.");

        mPrinter.setXPos(510);
        mPrinter.print("Total");

        mPrinter.newLine();         

        for (int i = 1; i < 15; i++) {
            mPrinter.setXPos(1);
            mPrinter.print("Produto de teste");

            mPrinter.setXPos(255);
            mPrinter.print("250,00");

            mPrinter.setXPos(350);
            mPrinter.print("999,99");

            mPrinter.setXPos(430);
            mPrinter.print("999,99");

            mPrinter.setXPos(495);
            mPrinter.print("999,99");
            mPrinter.newLine(1);                
        }           


    } catch (Exception e) {
        MessageBox.showException(e, true);
    }       
}
    
asked by anonymous 28.08.2017 / 16:30

0 answers