Robert,
OK - I'll research those options.
Thanks, DW
From: robert engels
Sent: Fri 1/12/2007 12:31 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Print Job dispatch from PDF using java job.print
Only certain printers can print PDF directly. If you query the
service, it is probably not a supported format.
If you convert the PDF to PS you will have better luck, but even then
most consumer grade printers do not have a postscript driver.
I think there is a Java PrintService that uses GhostScript available
somewhere...
You could also used a Java based PDF viewer - most have JavaBean
interfaces used for printing that can be done without the UI.
On Jan 12, 2007, at 11:21 AM, Webber, David (NIH/OD) [C] wrote:
> Folks - we're sending a print job from java using the code below.
>
> FileInputStream fin = new FileInputStream(fileLocation);
> Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.PDF,
> null);
>
> job.print(doc, pras);
>
>
> It prints the default account user separator job page on the
> printer - but not the content of the PDF as well.
>
> There's clearly a trick to send the PDF to the print so it gets
> interpreted and actually printed. Do we need to interprete it to
> PS first or something?
>
> I assume other people have this working - help please!
>
> Thanks, DW
>
> ========================
>
> public static void PrintPDFPages(Document document,String
> fileLocation) {
> try {
> PrintRequestAttributeSet pras = new
> HashPrintRequestAttributeSet();
> pras.add(new Copies(2));
>
> PrintService pss[] = PrintServiceLookup.lookupPrintServices
> (DocFlavor.INPUT_STREAM.PDF, pras);
>
> if (pss.length == 0)
> throw new RuntimeException("No printer services
> available.");
>
> PrintService ps = pss[0];
> System.out.println("Printer Name [0]"+pss[0].getName
> ().toString());
> System.out.println("Printer Name [1]"+pss[0].getName
> ().toString());
> System.out.println("Printer Name [2]"+pss[0].getName
> ().toString());
> PrintService ps1 =
> PrintServiceLookup.lookupDefaultPrintService();
> System.out.println("Default printer: "+ps1.getName());
>
> System.out.println("Printing to " + ps);
>
> DocPrintJob job = ps1.createPrintJob();
>
> FileInputStream fin = new FileInputStream(fileLocation);
> Doc doc = new SimpleDoc(fin, DocFlavor.INPUT_STREAM.PDF,
> null);
>
> job.print(doc, pras);
>
> fin.close();
> } catch (IOException ie) {
> ie.printStackTrace();
> } catch (PrintException pe) {
> pe.printStackTrace();
> }
> }
> }
>
>
>
> ----------------------------------------------------------------------
> ---
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to
> share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?
> page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/