[
https://issues.apache.org/jira/browse/PDFBOX-2844?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14605103#comment-14605103
]
John Hewson edited comment on PDFBOX-2844 at 6/29/15 4:36 AM:
--------------------------------------------------------------
These are your printer's margins. They're always less than the size of the
paper, though one inch is very large - Java's printing API is being
over-cautious here. Our task is to print within the imageable area, not to
decided what that area is - because it varies from printer to printer.
1.8 actually overwrites the imageable area with its own size (which is the
wrong thing to do) because it could cause ink to appear off the edge of the
printable area. So the behaviour in 2.0 looks to me to be correct. Users who
want to print beyond Java's default margins need to set the imageable area
themselves first. This code should do the trick:
{code}
Paper paper = printerJob.defaultPage().getPaper();
paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());
{code}
was (Author: jahewson):
These are your printer's margins. They're always less than the size of the
paper, though one inch is very large - Java's printing API is being
over-cautious here. Our task is to print within the imageable area, not to
decided what that area is - because it varies from printer to printer.
1.8 actually overwrites the imageable area with its own size (which is the
wrong thing to do) because it could cause ink to appear off the edge of the
printable area. So the behaviour in 2.0 looks to me to be correct. Users who
want to print beyond Java's default margins need to set the imageable area
themselves first.
> 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: [email protected]
For additional commands, e-mail: [email protected]