pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From STEPHEN LANNING <slann...@nhbb.com>
Subject Printing PDF save for large printer - java
Date Wed, 12 Dec 2018 20:28:47 GMT
Hello, may I ask for some help?

I am having a problem using pdfbox to print PDFs stored for a large 
printer onto letter size

When I print it the same way I print normal PDFs it prints just the upper 
left edge of the PDF image covering the entire 8X11 page.
On the next page there is a message PCL XL error Warning: illegalMedia 
Size.

Java code
PDDocument document = PDDocument.load(new File(s_pathAndFileName)); 
PrinterJob job = PrinterJob.getPrinterJob();
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet(); 
pras.add(Sides.DUPLEX);
job.setPageable(new PDFPageable(document));
job.setPrintService(myPrintService);
job.print(pras); 

I tried using scaling and the image prints portrait(should be landscape) 
and the entire image prints in the middle of page making it to small to 
read. Two and four inch boarders of white space.
I tried scaling.SCALE_TO_FIT and scaling.SHRINK_TO_FIT. Also attributes 
pras.add(MediaSizeName.NA_LETTER) or pras.add(MediaSizeName.ISO_A4). None 
had a positive effect.

Java code
PDDocument document = PDDocument.load(new File(s_pathAndFileName));
PDFPrintable printable = new PDFPrintable(document, Scaling.SCALE_TO_FIT, 
Orient);
PrinterJob job = PrinterJob.getPrinterJob();
job.setPageable(new PDFPageable(document);
job.setPrintService(myPrintService);
job.setPrintable(printable);

This apprently has to do with how the PDF was saved after it was set to 
print on a very large printer for engineering drawing specs.

Is there a solution that I have not gleaned from your web-sites?

Thank you for any help.

                Steve Lanning 
  Programmer NHBB Astro Division
  Phone: (603)524-0004  Ext: 6256




========================= NMB (USA) EMAIL NOTICE 
============================
The information contained herein may be confidential and proprietary and 
is intended only for 
the use of the addressee. Any unauthorized dissemination or disclosure of 
this communication
is strictly prohibited.  If you have received this communication in error, 
please notify the sender 
immediately. The information herein is not warranted to be free of virus 
or any other defect.
==============================================================================
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message