Hi,

loading a PDF should be done using PDDocument.load().

Take a look at java/org/apache/pdfbox/PrintPDF.java as a sample.

BR

Maruan Sahyoun

Am 06.08.2013 um 19:07 schrieb Alain <[email protected]>:

> Hi all,
> 
> I have an application that generates a PDF. I download the pdf to the client 
> and i'm using the PDFParser
> class to parse the PDF. Here is my code so far.
> 
> 
> 
> DocFlavor flavor = DocFlavor.SERVICE_FORMATTED.PAGEABLE;
> PrintRequestAttributeSet patts = new HashPrintRequestAttributeSet();
> PrintService[] ps =
> PrintServiceLookup.lookupPrintServices(flavor, patts);
> if (ps.length == 0) {
>     throw new IllegalStateException("No Printer found");
> }
> 
> PrinterJob job = PrinterJob.getPrinterJob();
> job.setPrintService(ps[8]);
> 
> PDFParser parser = new PDFParser(new ByteArrayInputStream(pdfDoc));
> parser.parse();
> job.setPageable(parser.getPDDocument());
> job.print();
> 
> 
> My problem is when a scanned image in a PDF format is processed, the page 
> printed is blank.
> 
> What i found was when a PDF file is created with PDF version 1.2, the image 
> does display on the print out.
> If the PDF file created under version 1.4, it is blank.
> 
> I was able to test this from using 2 different scanners, one generates a 1.2 
> file and the other a 1.4
> 
> Can anyone shed some light on where i should be looking..
> 
> Best Regards
> Alain

Reply via email to