Streaming PDF while generating

Streaming PDF while generating

Forum member · Jul 17, 2007
I have a web app that generates a large 100+ page PDF, which is composite of a number of Crystal report outputs + pages built with PNG images. Currently it generates the whole PDF and then send the final result, so it can take up to 2 minutes to build, and hence 2 minutes before the PDF gets sent to the browser, which is a lot of latency where nothing happens. Is it possible to stream chunks of the PDF to the browser while it is still being built, page by page? in the same way a static PDF can stream page by page? Thanks, Wayne.

Re: Streaming PDF while generating

Support · Jul 17, 2007
Hello Wayne, Unfortunately, this is not possible with a PDF because of limitations in the PDF standard. As you stated, linearized PDFs allow chucks of the PDF to be sent to the browser, but in order to create a linearized PDF, all contents of the PDF must already be known and laid out (i.e. all page contents and resources must already exist in order for the linearization process to be performed). About the only thing you could do, would be to display a "building..." message while the PDF is being created. Thanks, ceTe Software Support Team

Re: Streaming PDF while generating

Forum member · Jul 17, 2007
Wow, thanks for the fast reply! Unfortunaltely, your answer is what I thought would be the case. My actual problem is a reverse proxy gateway that is timing out after 30 seconds because it gets no response from the ASPX page (because it's busy building the PDF). Any suggestions?

Re: Streaming PDF while generating

Support · Jul 17, 2007
Hello Wayne, The only thing I can think of would be to have a thread process create the PDF and then keep refreshing the page until the PDF is created. This could get rather complicated, but a solution like this should do the trick. Unfortunately we don't have any examples of this, but if you get it or something similar working, we'd love to hear about it. Thanks, ceTe Software Support Team

Re: Streaming PDF while generating

Forum member · Jul 17, 2007
Yes it's the 'rather complicated' bit I was trying to avoid :-) I'll let you know how it goes.