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

ASF subversion and git services commented on PDFBOX-3306:
---------------------------------------------------------

Commit 1755094 from [~tilman] in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1755094 ]

PDFBOX-3306: only stretch to fit when enabled

> SCALE_TO_FIT with DPI yields incorrect margins
> ----------------------------------------------
>
>                 Key: PDFBOX-3306
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3306
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: Tres Finocchiaro
>
> When leveraging print margins using setImageableArea:
>  - Works fine when SCALE_TO_FIT and DPI 0 are provided (vector-quality 
> printing)
>  - Works fine when ACTUAL_SIZE and non-zero DPI are provided 
> - Does NOT work when SCALE_TO_FIT and non-zero DPI are provided.
> Code to reproduce
> {code:java}
> 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();
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to