The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

fubino (1) [Avatar] Offline
#1
Hi I do have to face the following problem.
My web application uses birtReport. I have to direct print a report. So I thought to open the report in pdf format in an hidden iframe, to get the stream of the pdf and to print it using the following code:

PdfReader pdfReader = new PdfReader(in);
PdfStamper pdfStamper = new PdfStamper(pdfReader,out);
pdfStamper.addJavaScript("this.print(false);");
pdfStamper.close();

out = response.getoutputstream but how can I populate the parameter in?
Do I have to convert the outputstream of the response in an inputstream? How can I do that?
Many thanks for any help.
blowagie (284) [Avatar] Offline
#2
Re: direct print of a report
Look for information on Java Web applications and 'Filters'.
Basically, you are going to put a Filter that
- takes the bytes of the ServletOutputStream of your BIRT Servlet
- uses these bytes as InputStream for PdfReader
- sends the new OutputStream to the end user.
There may be other (easier) solutions depending on how BIRT is used.
However, this is off-topic on this forum.
This is not an iText question. This is a Servlet question.
br,
Bruno