Subject: Re: Save PDF on the fly. 2007-11-01 - By Bruno Lowagie
Back Bhattacharyya Niladri (KSFJ 311) wrote: > Hi Bruno,
Hi Niladri, PLEASE DO NOT MAIL ME PERSONALLY! USE THE MAILING LIST INSTEAD!!! http://itext.ugent.be/info/contact.php
> Can you please help me how can I get a Open/Save dialog box > displayed once i generate a PDF on the fly so that the user can save the > file at any place where he wants to save.
Are you talking about a web application?
> I am coding like : > PdfWriter writer = PdfWriter./getInstance/(/document/, > new FileOutputStream("?bersicht.pdf")); > This creates the PDF in my workspace only.
Of course, as explained in the book, you can write a PDF to any OutputStream. For the small standalone examples, I use FileOutputStreams, because it's easy to run the sample code without having to install a server.
> Please help me if possible else tell me in ur book which chapter i can > get examples to show this dynamic saving of the PDF.
Chapter 17 is titled "iText in web applications", and it explains how to use iText to create PDF on the fly that can be opened in a browser. On p537 in that chapter, you'll read: Or, if you want the PDF to be saved, rather than to be viewed in the browser, you can force the browser to open a Save As dialog box like this: response.setHeader("Content-Disposition", " attachment; filename=\"my.pdf\"");
Of course, you'll need to read the complete chapter to understand how it all fits together. br, Bruno
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ __ ____ ____ ____ ____ ____ ____ ____ ____ ____ iText-questions mailing list iText-questions@(protected) https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
|
|