https://issues.apache.org/jira/browse/PDFBOX-3306
- [email protected] On Mon, Apr 4, 2016 at 9:58 AM, Tres Finocchiaro <[email protected] > wrote: > Bug report filed: > > > - [email protected] > > On Wed, Mar 30, 2016 at 12:08 PM, Tres Finocchiaro < > [email protected]> wrote: > >> The code says it all... >> >> To summarize: If we SCALE_TO_FIT and provide custom margins, we get very >> strange output. >> >> Before filing a bug, I wanted to make sure we're using the library >> correctly. >> >> https://gist.github.com/tresf/e6220b0880974df61ee41861c9e7193c >> >> >> public static void main(String[] args) throws Exception { >> PDDocument pdf = PDDocument.load(new URL(args[0]).openStream()); >> PrinterJob job = PrinterJob.getPrinterJob(); >> >> Paper paper = new Paper(); >> paper.setSize(612, 792); //8.5 x 11 in >> paper.setImageableArea(72, 72, 468, 648); //1 inch margins >> >> PageFormat page = job.getPageFormat(null); >> page.setPaper(paper); >> >> //Vector print - works as expected, margins applied and scaled properly >> job.setPrintable(new PDFPrintable(pdf, Scaling.SCALE_TO_FIT, false, 0, >> false), page); >> job.print(); >> >> //Unscaled raster print - works as expected, margins applied and >> document cut off >> job.setPrintable(new PDFPrintable(pdf, Scaling.ACTUAL_SIZE, false, 72, >> false), page); >> job.print(); >> >> //Scaled raster print - unexpected results, same scale as vector print, >> but same cut off as unscaled raster print >> job.setPrintable(new PDFPrintable(pdf, Scaling.SCALE_TO_FIT, false, 72, >> false), page); >> job.print(); >> >> pdf.close(); >> } >> >> >> >> - [email protected] >> > >

