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

John Hewson commented on PDFBOX-2844:
-------------------------------------

I'm thinking we need to make some changes to PDFPrinter, because it's fairly 
clear from the mailing list that the current API is confusing. As you say, not 
a good user experience. The code I posted actually requires the custom paper to 
then be passed to PDFPrinter, as the result of defaultPage() is a new object 
each time - but our custom paper API is confusing too, so I think we should fix 
the whole thing.

As far as I can tell the issue which confuses people is that our print() and 
silentPrint() methods are non-standard and obscure the underlying Java API. I 
think we should simply provide a PDFPageable class and have that be all. That 
way users can use the Java printing APIs and understand what they're doing, and 
it will be very easy for to do custom stuff if they wish. We can include some 
code to set the margins to a minimum too, in our example, which users can copy 
if they wish. Thoughts?

> Printing has bigger margins than expected
> -----------------------------------------
>
>                 Key: PDFBOX-2844
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2844
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>         Attachments: PDFBOX-2844.pdf
>
>
> Printing the attached file from PDFReader brings larger margins than 
> expected, and larger than with Adobe Reader. Doing the same with 1.8 has the 
> expected margins (but bad fonts).
> From Александр Свиридов / Alex Sviridov in the mailing list:
> {quote}
> I printed this pdf file with Adobe Reader in mode 100%. And as expected left 
> and right margins are about 2cm. In comparison when I print using pdfbox left 
> margin is 4.5cm, right about 3.5cm.
> The code I use :
> {code}
> PrinterJob job = PrinterJob.getPrinterJob();
> Paper paper=new Paper();
> paper.setSize(72d*8.267d, 72d*11.692);
> PDFPrinter pDFPrinter=new PDFPrinter(document,Scaling.SCALE_TO_FIT, 
> Orientation.PORTRAIT,paper);
> pDFPrinter.silentPrint(job);
> {code}
> {quote}



--
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