You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Patrick JUSSEAU <pa...@free.fr> on 2010/01/04 18:21:03 UTC

Print area is not entirely printed using system default A4 format

Hi,

I am trying to use pdfbox to print a pdf file in A4 format. The  
problem I have is that not all the pdf file area is printed even  
though I specify a A4 format in the printer job selector (the right  
and bottom part of the pdf file gets cropped).

Here is the code I use :

PrinterJob printJob = PrinterJob.getPrinterJob();

PageFormat pageFormat = printJob.defaultPage();
pageFormat = printJob.validatePage(pageFormat);

// to remove margins
Paper paper = p_pageFormat.getPaper();
paper.setImageableArea(0, 0, paper.getWidth(), paper.getHeight());

pageFormat.setPaper(paper);

PDDocument document = // ... create document
document.print(printJob);


It seems to me that whatever values I provide calling  
#setImageableArea() is not taken into consideration. I tried a dummy  
call like #setImageableArea(0, 0, 200, 200) which does not affect the  
printed area.

Could this be a bug or am I doing something wrong?

Thanks,
- Patrick