I'm trying to print pfd from java application
this is the code:
DocFlavor flavor = DocFlavor.INPUT_STREAM.PDF;
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
aset.add(MediaSizeName.ISO_A4);
aset.add(new Copies(1));
PrintService service = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob printJob = service.createPrintJob();
Doc doc = new SimpleDoc(filePDF,flavor,null)
try {
printJob.print(doc, aset);
} catch (PrintException e) {
e.printStackTrace();
}
but it doesn't work, can you help me?