private static void printPdf(File filename) throws PrintException, IOException{
PrintService ps = PrintServiceLookup.lookupDefaultPrintService();
System.out.println(ps.getName());
PrintService myService = ps;
FileInputStream fis = new FileInputStream("C:\\PrintLabel\\File.pdf");
Doc pdfDoc = new SimpleDoc(fis, DocFlavor.INPUT_STREAM.AUTOSENSE, null);
DocPrintJob printJob = myService.createPrintJob();
printJob.print(pdfDoc, new HashPrintRequestAttributeSet());
System.out.println("print is called");
fis.close();
}
Java print service is creating print job but print is not happening via zebra zp500 plus// Expert user has replied. |
2 Replies
Hi Dig,
I believe the issue might be because you are trying to print a PDF document. Zebra printers are unable to print PDFs directly. The simplest way to print a PDF is to convert it to a PNG image and print that.
Hi Samantha,
Thanks for your comment.
I am unable to print PDF using my java program but why it is allowing the PDF print manually using Adobe Reader ? Can you please explain