4 Replies Latest reply: Mar 12, 2009 7:15 AM by 800456 RSS

    Printing PDF file

    800460
      I tried printing pdf file.But it is giving a blank page to printer.

      Do anyone has got any idea?
      PrintRequestAttributeSet prs =  new HashPrintRequestAttributeSet();
                   DocFlavor flavor = DocFlavor.INPUT_STREAM.GIF;
                   PrintService printService[] = PrintServiceLookup.lookupPrintServices(flavor, prs);
                   PrintService defaultService = PrintServiceLookup.lookupDefaultPrintService();
                   PrintService service = ServiceUI.printDialog(null, 200, 200,printService, defaultService, flavor, prs);
                   if (service != null) 
                   {
                     System.out.println("Service is not null now ---------------");
                     DocPrintJob jobs = service.createPrintJob();
                     FileInputStream fis = new FileInputStream("MyData.pdf");
                     DocAttributeSet das = new HashDocAttributeSet();
                     Doc docu = new SimpleDoc(fis, flavor, das);
                     job.print(docu, prs);
                   }