S3 <stein <at> duvel.ir.iit.edu> writes:
>
>
> >How to create a pdf with an pdf input stream from a web service call and
> >silently print the content of it ?
>
> Once the PDF is generated, the easiest way to print it
> would probably be to write it to a temporary file.
> Then, you can tell it to print, which is OS specific.
> So, if it was Windows, it might be named something like:
> pdfname=c:\temp\printpdf\asrcpdiu.pdf
> Then, the command would be (using ghostscript):
> "c:\program files\ghostgum\gsview\gsprint.exe" \
> -printer %printername% -color %pdfname%
>
> On a Unix (such as Linux), it could be:
> pdfname=/tmp/printpdf/asrcpdiu.pdf
> And the command would be:
> lpr "$pdfname"
>
> (I have a Windows Python script to print from a directory, if you need it.)
>
> I hope that that answers (the printing part of) your question.
>
Hi,
Thanks for a quick response!!!
I have to do this in the client browser so this might not help me. I have
written a servlet which is reading the PDFStream and displaying the document in
the client browser in EMBED Tag but its not printing even though I have called
addJavaScript.
Please help!!!
Code:
======
Document document = new Document(PageSize.LETTER,40,40,40,40);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, baos);
document.open();
writer.addJavaScript("this.print(true);");
InputStream in = docContent.getInputStream();//this is the PDF Stream
PdfStream stream = new PdfStream(in,writer);
writer.addToBody(stream);
stream.writeLength();
in.close();
resp.setContentType("application/pdf");
resp.setContentLength(baos.size());
baos.writeTo(out);
out.flush();
Thanks,
Vasu
-------------------------------------------------------------------------
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/