Java print service is creating print job but print is not happening via zebra zp500 plus

// Expert user has replied.
D Dig Dub 3 years 7 months ago
77 2 0

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();
 
}

Please Register or Login to post a reply

2 Replies

S Samantha Corn

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.

D Dig Dub

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

CONTACT
Can’t find what you’re looking for?