Ok. Thanks for the trouble.
Bruno Lowagie (iText) schrieb: > Peyman Pouryekta wrote: > >> I am using the spring framework and there is a class called >> AbstractPdfView to create PDFs with iText. >> there is one method to create a PDF. >> >> protected abstract void buildPdfDocument(Map model, >> com.lowagie.text.Document document, >> com.lowagie.text.pdf.PdfWriter writer, >> HttpServletRequest request, >> HttpServletResponse response) >> throws Exception >> >> Subclasses must implement this method to build an iText PDF >> document, given the model. Called between Document.open() and >> Document.close() calls. > > Apparently, this is a limitation imposed by Spring. > >> Note that the passed-in HTTP response is just supposed to be used >> for setting cookies or other HTTP headers. The built PDF document itself >> will automatically get written to the response after this method returns. > > Then what is the PdfWriter used for? > >> So I need a document to create a PDF. > > And a PdfWriter instance. > >> How can I add the ByteArrayOutputStream Document > > I don't know how Spring works. > Unlike many of my colleagues that are working with > Spring, I didn't have the time to have a look at > the framework. > >>> This is an altered code snippet: > > Document document = new Document(); > ByteArrayOutputStream baos = new ByteArrayOutputStream(); > PdfWriter writer = new PdfWriter(document, baos); > document.open(); > // do stuff; > document.close(); > baos.writeTo(response.getOutputStream()); > > br, > Bruno > > ------------------------------------------------------------------------- > 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/
