pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Issue printing with shrink to fit
Date Thu, 04 May 2017 19:13:55 GMT
Could this help? This is example code from Printing.java:



     /**
      * Prints using a custom page size and custom margins.
      */
     private static void printWithPaper(PDDocument document)
             throws IOException, PrinterException
     {
         PrinterJob job = PrinterJob.getPrinterJob();
         job.setPageable(new PDFPageable(document));

         // define custom paper
         Paper paper = new Paper();
         paper.setSize(306, 396); // 1/72 inch
         paper.setImageableArea(0, 0, paper.getWidth(), 
paper.getHeight()); // no margins

         // custom page format
         PageFormat pageFormat = new PageFormat();
         pageFormat.setPaper(paper);

         // override the page format
         Book book = new Book();
         // append all pages
         book.append(new PDFPrintable(document), pageFormat, 
document.getNumberOfPages());
         job.setPageable(book);

         job.print();
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message