I wrote something up on this a while ago ... there's some new
information added to the Wiki.

http://webware.colorstudy.net/twiki/bin/view/Webware/PdfCreationWithReportLab001

It explains how to get the result you want.

If you have any more questions please let me know ... I've been doing
this with WebWare / Zope for the past few months so I've run into almost
all the problems ( I hope! ;D )

Here's the statements I add to my servlets in WebWare / Zope.

container.REQUEST.RESPONSE.setHeader("Content-type:","application/pdf")
container.REQUEST.RESPONSE.setHeader("Content-disposition:","attachment;
filename=rptWoOpen.pdf")

It seems that the Content-disposition one is the key.

Take care,

Ray

On Tue, 2002-06-04 at 13:15, Tim Roberts wrote:
> This message is only marginally related to webware, but you folks have 
> probably run up against this.
> 
> I have a webware site in which I need to produce reasonably good looking 
> printed output.  We all know that the current generation of browsers has an 
> extremely high degree of suckage in its ability to render tabular-formatted 
> printed output.  So, I decided to use ReportLab to produce PDF files.
> 
> Overall, I am delighted with the results.  I get a huge amount of control and 
> flexibility, and it looks exactly right on everyone's computer.  However, I'm 
> not entirely happy with the mechanism.
> 
> Here's the way I would LIKE it to work.
> 1. User fills out form, clicks submit.
> 2. Form fires Webware servlet.
> 3. Servlet returns magic header that tells the browser "whoops, here
>    comes PDF data".
> 4. Browser gives familiar "run from here or save to disk" dialog, or else
>    fires Acrobat Reader inside browser.
> 
> I can't seem to make this happen automagically.  What I do now is have the 
> Webware servlet render to a PDF file on the server, then send the browser a 
> redirect to that file.  That way, the browser sees the PDF extension on the 
> URL and does the right thing.
> 
> I don't like this, for several reasons: if I use a single file name, I limit 
> my number of concurrent users to 1 (that's not a problem today, but it will 
> be).  If I use generated file names, I have to manage them somehow.  I don't 
> really need to retain the PDF files at all.
> 
> So, is there a way that a Webware servlet can generate something that passes 
> through Apache and looks to the browser as if it were a PDF binary, without 
> using this redirect trick?  I tried various permutations of "Content-Type", 
> including application/pdf, but I didn't come up with the right recipe.
> 
> (One alternative is for me to do an immediate redirect to a Python script 
> that happens to be named "xxxx.pdf"; this also works, but seems sort of 
> illegitimate.)
> 
> --
> - Tim Roberts, [EMAIL PROTECTED]
>   Providenza & Boekelheide, Inc.
> 
> 
> 
> _______________________________________________________________
> 
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> 
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss


_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to