You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Art Welch <ar...@EASTPOINT.COM> on 2001/03/29 20:33:36 UTC

Streaming PDF

I saw streaming PDFs mentioned in a recent e-mail. I do not know if what I
am about to say will be relevant to the original topic, but I thought that I
would relate the information anyway.

I had been having a problem in my environment where PDFs generated
dynamically by FOP running in a servlet were not rendered properly in M$ IE
5. It was discovered that large PDFs (> 8k) displayed properly, but small
ones did not display at all. Further discussion on the list suggested that
IE requires that either the content-length be set or the data sent HTTP
chunked. I do not like having to store a potentially quite large PDF just so
that I can find out how big it is to set the header. So I tried implementing
an HTTP Chunked OutputStream. This was not too difficult to do and it kind
of works, except that in my testing I found that even with the chunked
output, small (< 8k) PDFs STILL DO NOT DISPLAY IN IE5! I then changed the
chunked output stream to use an 8k buffer to build the chunks. If the output
is closed before the buffer is filled the first time then I just set the
content-length header and send the contents of the buffer non-chunked. If
there is more output after the buffer has been filled then the data is sent
chunked. So far this seems to be working, but I have not tested it
rigorously. I also understand that since this requires HTTP 1.1 it may not
work in the general case.

I present this information in the hopes that it will be helpful to someone.
I do not think that FOP should attempt to include chunked output capability.
It should write to a stream - the stream implementation determined by the
external application. For anyone interested in doing the same thing, there
are a few chunked stream implementations out there - or you could write your
own. My implementation is kind of limited and not well tested, so I am not
willing to make it available at this point. Maybe I will reconsider after I
have done more testing - but at the moment I am preoccupied with migrating
my application to XalanJ2 from XalanJ1 and have not been able to look at FOP
or output related things for a while.

FYI,
Art

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org