[mod_python] ReportLab integration

Colin Bean ccbean at gmail.com
Mon Oct 16 15:04:47 EDT 2006


Hi Jim,

How does it break in IE?  If it it won't recognize the result is a
pdf, try setting the content-disposition header.  You can use this to
specify a filename that browser will save your file as; if you give it
a .pdf extension then IE should open it fine.  Here's a little more
info on it:
http://support.microsoft.com/kb/260519

I *think* that changing your handler to use a .pdf extension will do
the same thing (I haven't used publisher yet so I'm not sure how to do
this); the content disposition trick might be easier, though.

-Colin

On 10/16/06, Jim Steil <jim at qlf.com> wrote:
>
>
>
>
> Graham:
>
>
>
> Thanks so much for the examples.  That's exactly what I needed.  I used the
> example in Reportlab-demo.py and it is working great in FireFox, but not in
> IE.  There is a comment in the source about IE choking on some code but I
> don't know how to get around that.  Also, is there some trick or
> configuration I need to do to get a .pdf extension on my url?  I'm using the
> publisher handler.
>
>
>
> Thanks again.  What I've got working now really helps, and getting around
> these 2 issues would just be icing on the cake!
>
>
>
>             -Jim
>
>
>
>
> Jim Steil
>  IT Manager
>  Quality Liquid Feeds
>  (608) 935-2345
>
> (608) 341-9896 cell
>
>  ________________________________
>
>
> From: Graham Dumpleton [mailto:grahamd at dscpl.com.au]
>  Sent: Saturday, October 14, 2006 12:54 AM
>  To: Jim Steil
>  Cc: mod_python at modpython.org
>  Subject: Re: [mod_python] ReportLab integration
>
>
>
>
>
>
>
>
> On 14/10/2006, at 6:25 AM, Jim Steil wrote:
>
>
>
>
>
>
> Can someone help get me pointed in the right direction?  I want to allow a
> user to request a PDF from my mod_python app.  When they do so, I want to
> generate the PDF on the fly with ReportLab and then send the resulting PDF
> back to the browser without saving it anywhere.  I've done some searches on
> the web but can't seem to find examples of doing this with just mod_python
> and ReportLab.  I've seen examples of using other tools, but not just
> mod_python.  This sounds like something others are probably doing, but I
> need a push in the right direction.  Thanks in advance for your time.
>
> Try:
>
>
>
>
>
>
> http://www.dscpl.com.au/projects/vampire/examples/reportlab/reportlab-demo.pdf
>
>
>
>
>
> This uses reportlab to generate the PDF.
>
>
>
>
>
> There is also:
>
>
>
>
>
>
> http://www.dscpl.com.au/projects/vampire/examples/reportlab/trml2pdf-demo.pdf
>
>
>
>
>
> This uses free version of tool for converting reportlab RML to PDF.
>
>
>
>
>
> The actual source code for each is at:
>
>
>
>
>
>
> http://www.dscpl.com.au/projects/vampire/source/examples/reportlab/reportlab-demo.py
>
>
>
>
>
>
> http://www.dscpl.com.au/projects/vampire/source/examples/reportlab/_handler.py
>
>
>
> http://www.dscpl.com.au/projects/vampire/source/examples/reportlab/trml2pdf-demo.rml
>
>
>
>
>
> These happen to use Vampire for the mod_python handler framework,
>
>
> but you should be able to adapt them to other mod_python handler
>
>
> systems.
>
>
>
>
>
> Graham
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>
>
>


More information about the Mod_python mailing list