Hi All,
I need to print the pdf file to printer which is connected to the System
silently.
I Tried it as follows:
*public static void printPdfReport(String pdfReportFilePath, String
printerName) throws PredictionReportException {
if (pdfReportFilePath == null)
throw new PredictionReportException("Input file is null");
System.out.println("\n Using print Service " + printerName);
PrintService printService = getPrintServiceByName(printerName);
if (printService == null)
throw new PredictionReportException("Unable to find the print
service");
DocPrintJob job = printService.createPrintJob();
DocFlavor flavor = DocFlavor.INPUT_STREAM.PDF;
PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
pras.add(new Copies(1));
FileInputStream fis;
try {
fis = new FileInputStream(pdfReportFilePath);
DocAttributeSet das = new HashDocAttributeSet();
Doc doc = new SimpleDoc(fis, flavor, das);
job. print(doc, pras);
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new PredictionReportException(e);
} catch (PrintException e) {
e.printStackTrace();
throw new PredictionReportException(e);
}
}*
But it is working in few systems only.
Thanks
Shyam K
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php