I have a requirement to print pdf files in two different ways -one through web page where user will see the print preview and choose the printer and print it. Second way is to a
Have you tried JPadel to print PDF files:
Excerpt from Sample codes
final PdfBook pdfBook = new PdfBook(pdfDecoder, printJob.getPrintService(), attributes);
pdfBook.setChooseSourceByPdfPageSize(false);
final SimpleDoc doc = new SimpleDoc(pdfBook, DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
// used to track print activity
printJob.addPrintJobListener(new PDFPrintJobListener());
try {
printJob.print(doc, attributes);
}
catch (final Exception e) {
LogWriter.writeLog("Exception " + e + " printing");
//
}
In addition to this you can provide the printer name and add a listner PDFPrintJobListener
as well.