<P>PDF Document as an Output Stream.</P>
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Carl_Daver
Posted On:   Tuesday, June 18, 2002 10:31 PM

Hi, I have created a PDFwriter class that easily creates and writes a PDF document stream to a fileout stream. I am using JSP to do the same. What i want to do now is directly send the stream to an output stream instead of a fileoutput stream. Question is which one?? How do i pass it to response obj, (response.setOutputStream(System.out) does not work) I am Pasting some code so that you can understand what i mean( >> means next step) Document document = new Document(PageSize.A4.rotate(), 10, 10, 30, 20); >> File file = new File("C:\ePro\PDFGenerator\Report.pdf"); >> document.open(); Table table = new Table(9); &g   More>>

Hi,


I have created a PDFwriter class that easily creates and writes a PDF document stream to a fileout stream.
I am using JSP to do the same.


What i want to do now is directly send the stream to an output stream instead of a fileoutput stream.
Question is which one??

How do i pass it to response obj, (response.setOutputStream(System.out) does not work)

I am Pasting some code so that you can understand what i mean( >> means next step)


			
Document document = new Document(PageSize.A4.rotate(), 10, 10, 30, 20); >>

File file = new File("C:\ePro\PDFGenerator\Report.pdf"); >>
document.open();

Table table = new Table(9); >> table.setPadding(0); >> table.setSpacing(1); >>

table.addCell(new cell ("Any String",fontF); >> document.add(table); >> document.close(); >>

PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(file));


The above code creates a PDF file on my disk which i can then redirect. Eg

			
response.setContentType("application/pdf");
response.sendRedirect("Report.pdf");


What i want now is to replace the constructor for PDFWriter with a different Output stream and
directly write it to browser.


Please help as i am stuck for quite some time now....
   <<Less

Re: <P>PDF Document as an Output Stream.</P>

Posted By:   Lukas_Marek  
Posted On:   Wednesday, June 19, 2002 08:55 AM

Try following:

PdfWriter writer = PdfWriter.getInstance(document, response.getOutputStream());

It shall be working.
About | Sitemap | Contact