Hi!
I'm using PDFBox 1.8.9 and using this method to print a PDF file:
private static void printWithPDFBox(File pdfFile, int copies) {
PDDocument document = null;
try {
document = PDDocument.load(pdfFile);
PrintService printService =
PrintServiceLookup.lookupDefaultPrintService();
PrinterJob printJob = PrinterJob.getPrinterJob();
printJob.setJobName(pdfFile.getName());
printJob.setPrintService(printService);
printJob.setCopies(copies);
HashPrintRequestAttributeSet printRequestAttributeSet = new
HashPrintRequestAttributeSet();
printRequestAttributeSet.add(new Copies(copies));
printRequestAttributeSet.add(SheetCollate.COLLATED);
printJob.setPageable(new PDPageable(document, printJob));
printJob.print(printRequestAttributeSet);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (document != null) {
try {
document.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
I have a test file with one page and when I call this method with copies
greater than 1 I only get one page printed out.
Am I doing something wrong?
Best regards,
Kovi
--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~