On Tue, Apr 13, 2010 at 2:18 PM, Thomas G. Willis <[email protected]> wrote: > On Tue, Apr 13, 2010 at 2:07 PM, Krishnakant Mane <[email protected]> wrote: >> On Tuesday 13 April 2010 11:13 PM, Thomas G. Willis wrote: >>> >>> For server side, there's report lab >>> >>> http://pypi.python.org/pypi/reportlab >>> I have used report lab before to generate pdf but I did not quite >>> understand how it will help at the server side with my pylons app? >>> >> >> Is there a way to render pdf directly to a web browser (provided of course >> that the browser has the plugin for viewing pdf). >> > > I'd have to look at the docs to be sure, but getting the browser to > pick it up as a pdf and use the associated application should be a > matter of setting the headers correctly on the response.
You can send the PDF just as you would any other type of *binary* file, such as an image....do not attempt to process it as text. Use the content-type header of "application/pdf". Note if you have large reports, you may want to see if you can support the HTTP byte-ranges protocol. This is because PDF files are read starting at the end of the file, and then in a random-access manner on a page-by-page basis. So if you have a 500 page report, a person can immediately read page 1, or page 250, without waiting for the entire PDF file to download. .... However, supporting byte-ranges can be quite a bit of work, and doing nothing special just means that the user will have to wait for the entire PDF file to finish downloading before anything gets displayed. -- Deron Meranda http://deron.meranda.us/ -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
