Caros já procurei em vários lugares mas não encontrei uma forma de imprimir PDF frente e verso(DUPLEX).
Ó código abaixo imprimi corretamente PDF, porem o atributo DUPLEX não funciona.
FileInputStream psStream = null;
try {
File f = new File(nomedoarquivo);
psStream = new FileInputStream(f);
FileChannel fc = psStream.getChannel();
ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
PDFFile pdfFile = new PDFFile(bb);
PDFPrintPage pages = new PDFPrintPage(pdfFile);
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(new Copies(1));
aset.add(MediaSizeName.ISO_A4);
aset.add(OrientationRequested.LANDSCAPE);
aset.add(Sides.TUMBLE);
PrinterJob pj = PrinterJob.getPrinterJob();
PageFormat pf = PrinterJob.getPrinterJob().getPageFormat(aset);
pj.setJobName(f.getName());
Book book = new Book();
book.append(pages, pf, pdfFile.getNumPages());
pj.setPageable(book);
pj.print();
return "Impressa ";
} catch (Exception ex) {
ex.printStackTrace();
return "Erro ao imprimir PDF.";
}
Alguém me ajude, pois estou precisando muito de alguma dica.