Incorrect margin with Brother QL-560 printer using java

I have a problem with the Brother QL-560 brand using java. I already tested xhtml-printable and solutions for PDF rendering.

Using the xhtml-printable solution, even if the upper left corner of the image area is set to x = 0 and y = 0, the content is printed with a certain number of left and top fields (or in PORTRAIT, Landscape mode).

Here is the result:

enter image description here

A black frame was inserted to emphasize the margin problem. The java code used for printing is the same as in this post, but converted to Java.

, PDF XHTML. , PDF , iText, PDF Renderer ( PDFPrintPage, "print" ). , .

(XHTML), ?

.

______________ _________________________

, : labelPaper.setImageableArea(+50,+50,paperWidth, paperHeight);. : enter image description here

??? ... +50 (x) +50 (y)... , PORTRAIT? :

public void print(PrintService service){

        try{
            float paperWidth = 62.0f;
            float paperHeight = 62.0f;
            paperWidth *= 2.83;
            paperHeight *= 2.83;

            //val printJob = PrinterJob.getPrinterJob
            PrinterJob printJob = PrinterJob.getPrinterJob();
            printJob.setPrintService(service);

            PageFormat pageFormat = printJob.defaultPage();
            pageFormat.setOrientation(PageFormat.PORTRAIT);
            Paper labelPaper = pageFormat.getPaper();
            labelPaper.setSize(paperWidth, paperHeight);
            labelPaper.setImageableArea(+50,+50,paperWidth, paperHeight);
            pageFormat.setPaper(labelPaper);

            Book book = new Book();
            book.append(this.createRender(), pageFormat);
            printJob.setPageable(book);

            PrintRequestAttributeSet attributeSet = new HashPrintRequestAttributeSet();
            attributeSet.add(new PrinterResolution(300, 300, ResolutionSyntax.DPI));
            printJob.print(attributeSet);

... ? 0x 0y.

+3

All Articles