Printing PDF from Java
807569Jul 6 2006 — edited Jul 6 2006Hi
I have a requirement to generate a PDF report and than print it using a backend process. One report has 2 pages, first page has paper size letter and next A4. I am able to generate PDF using Apache FOP. But have been unable to print it. Printer we are using does not support PS or PCL by default. I can print using Adobe reader but not through code.
I have tried following softwares so far but to no avail:
1. GhostScript with Redmon: I have set up the Redmon port with following parameters
Redirected to program=D:\gs\gs8.53\bin\gswin32c.exe
arguments=@d:\gs\jpeg.rsp -sOutputFile="%%handle%%%h"
output=Copy pipe to printer
I convert the pdf to PCL/PS but its not getting printed due to incompatibility of printer to understand PCL/PS directly.
2. Used gsprint from the GSView but I am not able to set the pagesize.
3. PDFBox : On printing the generated PDF gives me following error
Exception in thread "main" java.lang.RuntimeException: Not yet implemented
at org.pdfbox.pdmodel.font.PDType0Font.drawString(PDType0Font.java:75)
at org.pdfbox.pdfviewer.PageDrawer.showCharacter(PageDrawer.java:128)
at org.pdfbox.util.PDFStreamEngine.showString(PDFStreamEngine.java:448)
at org.pdfbox.util.operator.ShowTextGlyph.process(ShowTextGlyph.java:90)
at org.pdfbox.util.PDFStreamEngine.processOperator(PDFStreamEngine.java:494)
at org.pdfbox.util.PDFStreamEngine.processSubStream(PDFStreamEngine.java:207)
at org.pdfbox.util.PDFStreamEngine.processStream(PDFStreamEngine.java:160)
at org.pdfbox.pdfviewer.PageDrawer.drawPage(PageDrawer.java:97)
at org.pdfbox.pdmodel.PDPage.print(PDPage.java:749)
at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1785)
at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1334)
at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1196)
at org.pdfbox.pdmodel.PDDocument.print(PDDocument.java:712)
Would really appreciate if someone can give me some guidance or sample code or software to use. We are using XEROX WorkCenter M123 PCL 6 printer and OS will be linux.
Regards
Jay Gaba