[ 
https://issues.apache.org/jira/browse/PDFBOX-2033?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13973841#comment-13973841
 ] 

Tilman Hausherr commented on PDFBOX-2033:
-----------------------------------------

Source code to reproduce the effect:

{code}
        PDDocument document = new PDDocument();
        PDPage pdPage = new PDPage(new PDRectangle(198.425f, 1700.787f)); // = 
70 x 600 mm
        document.addPage(pdPage);
        PDFont font = PDType1Font.HELVETICA_BOLD;
        PDPageContentStream contentStream = new PDPageContentStream(document, 
pdPage);
        contentStream.beginText();
        contentStream.setFont(font, 12);
        contentStream.moveTextPositionByAmount(100, 10);
        for (int i = 0; i < 17; ++i)
        {
            contentStream.drawString("Hello World " + i);
            contentStream.moveTextPositionByAmount(0, 100);
        }
        contentStream.endText();
        contentStream.moveTo(1, 1);
        contentStream.lineTo(1, 1700);
        contentStream.lineTo(197, 1700);
        contentStream.lineTo(197, 1);
        contentStream.closeAndStroke();
        contentStream.moveTo(1, 1);
        contentStream.lineTo(197, 1700);
        contentStream.closeAndStroke();
        contentStream.moveTo(1, 1700);
        contentStream.lineTo(197, 1);
        contentStream.closeAndStroke();
        contentStream.close();
        System.out.println(document.getPage(0).findMediaBox());
        System.out.println(document.getPage(0).findCropBox());
//        document.save("XXXXXXXXXXX/Page.pdf");
        Paper paper = new Paper();
        paper.setSize(198.425f, 1700.787f);
        //PDFPrinter pdfPrinter = new PDFPrinter(document, 
PrinterJob.getPrinterJob()); // A4
        //PDFPrinter pdfPrinter = new PDFPrinter(document, Scaling.ACTUAL_SIZE, 
Orientation.AUTO, paper, 0);
        PDFPrinter pdfPrinter = new PDFPrinter(document, 
PrinterJob.getPrinterJob(), Scaling.ACTUAL_SIZE, Orientation.AUTO, paper, 
false, 0); // blank
        //PDFPrinter pdfPrinter = new PDFPrinter(document, Scaling.ACTUAL_SIZE, 
Orientation.AUTO); // cut off
        //PDFPrinter pdfPrinter = new PDFPrinter(document, 
Scaling.SCALE_TO_FIT, Orientation.AUTO); // A4
        //PDFPrinter pdfPrinter = new PDFPrinter(document, 
Scaling.SHRINK_TO_FIT, Orientation.AUTO); // A4
        pdfPrinter.silentPrint();
        document.close(); {code}


> Narrow long pdf is printed blank
> --------------------------------
>
>                 Key: PDFBOX-2033
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2033
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>         Environment: W7
>            Reporter: Tilman Hausherr
>
> Based on the post of Norbert Sándor to the user list:
> When printing a 198.425 x 1700.787 sized page (70 x 600 mm) using new 
> PDFPrinter(pdfDocument, printJob).silentPrint() to a virtual printer (e.g. 
> PDFCreator or CIB), then the resulting PDF has a page size of 8,26x11,69 and 
> the content is horizontally centered on the page. I was able to reproduce the 
> problem, and also to print on a virtual printer that creates new PDFs of that 
> size, by using the longest constructor of PDFPrinter(), but then the output 
> is blank.
> While it is probably irrelevant to print a PDF to a PDF, the problem might 
> make sense when printing to a cash register receipt printer.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to