You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Sonja Löhr <so...@arcor.de> on 2005/09/19 18:45:13 UTC
compressing pdf response
Hi!
This is not a FOP question, but you I'm sure you are familiar with these
things
I use FOP in a servlet and would like to add a CompressionFilter since the
output pdf is very large.
I tried to get the output with firefox and IE the Browsers cannot handle the
output. (IE sometimes (?) can, firefox never.
The actual compression is that one:
gzipstream = new GZIPOutputStream(output);
flushToGZip();
response.addHeader("Content-Encoding", "gzip");
response.setContentType("application/pdf");
I added the last line since I hoped it could help (additionally), but it
doesn't. Is there something else I could try to configure on any of the
Streams concerned?
Before compressing, both browsers pass a test whether compressed data are
accepted.
Thanks for you help again!
sonja
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: compressing pdf response
Posted by John Burgess <jo...@riskdecisions.com>.
We have a reporting tool here that produces the reports as pdfs. It has
always worked with internet explorer but not with firefox or mozilla
until recently, with both of them giving the message "File does not
start with %PDF". Recent updates to mozilla and firefox have meant that
about 75% of the reports will now open in all browsers. After seeing
this thread I have just modified the compression filter we use to not
compress servlets with a name ending in .pdf (we map the report
producing servlet to getrep.pdf to make sure Internet Explorer realises
that it is getting a pdf file - not all versions will honour the mime type).
Now all reports are correctly displayed in all browsers. I've had a
look at the gains we were getting with the compressed pdfs and it was
only about 5% on average so removing compression is not going to be noticed.
In summary, it appears that firefox and mozilla do not fully support
compressed pdfs.
Jan Pernica wrote:
> Anyway the browser does not display PDF correctly if it is compressed.
>
> Regards
>
> Jan
> Sonja Löhr wrote:
>
>> Thanks to you all!
>>
>> If the improvement is so small I will unplug the filter. Although the
>> browsers do support compression (the filter is checking this), the
>> outcome seems to be somewhat unpredictable, and I don't know anything
>> about the client side in production, of course.
>> sonja
>>
>>
>> Am Montag, den 19.09.2005, 21:48 +0200 schrieb J.Pietschmann:
>>
>>
>>> Sonja Löhr wrote:
>>>
>>>
>>>> With IE (that is, acrobat inside) I get sometimes the pdf and
>>>> sometimes a
>>>> blank page, after reloading the message about a "damaged file". Firefox
>>>> (always) complains that the file "doesn't begin with %PDF-" (ok,
>>>> indeed both
>>>> speak German ;-)
>>>>
>>>
>>> The browser explicitly asks if it will accept a compressed
>>> response. The server is *not* allowed to use compression (at the
>>> HTTP level) if the browser doesn't ask for it. Check your browser
>>> configuration. In Firefox, you might try the HTTP live headers
>>> extension for sniffing the actual values.
>>>
>>> Also, most of the PDF parts are already compressed (and re-encoded
>>> as ASCII85). A secondary compression will probably gain something
>>> between 15% and 20% for typical PDF files. Significant improvements
>>> are only to be expected in case of large embedded BMP images and in
>>> some cases if there are large embedded fonts.
>>>
>>> J.Pietschmann
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>>
>>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: compressing pdf response
Posted by Jan Pernica <ja...@pernica.org>.
Anyway the browser does not display PDF correctly if it is compressed.
Regards
Jan
Sonja Löhr wrote:
>Thanks to you all!
>
>If the improvement is so small I will unplug the filter. Although the
>browsers do support compression (the filter is checking this), the
>outcome seems to be somewhat unpredictable, and I don't know anything
>about the client side in production, of course.
>
>sonja
>
>
>Am Montag, den 19.09.2005, 21:48 +0200 schrieb J.Pietschmann:
>
>
>>Sonja Löhr wrote:
>>
>>
>>>With IE (that is, acrobat inside) I get sometimes the pdf and sometimes a
>>>blank page, after reloading the message about a "damaged file". Firefox
>>>(always) complains that the file "doesn't begin with %PDF-" (ok, indeed both
>>>speak German ;-)
>>>
>>>
>>The browser explicitly asks if it will accept a compressed
>>response. The server is *not* allowed to use compression (at the
>>HTTP level) if the browser doesn't ask for it. Check your browser
>>configuration. In Firefox, you might try the HTTP live headers
>>extension for sniffing the actual values.
>>
>>Also, most of the PDF parts are already compressed (and re-encoded
>>as ASCII85). A secondary compression will probably gain something
>>between 15% and 20% for typical PDF files. Significant improvements
>>are only to be expected in case of large embedded BMP images and in
>>some cases if there are large embedded fonts.
>>
>>J.Pietschmann
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>>For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: compressing pdf response
Posted by Sonja Löhr <so...@arcor.de>.
Thanks to you all!
If the improvement is so small I will unplug the filter. Although the
browsers do support compression (the filter is checking this), the
outcome seems to be somewhat unpredictable, and I don't know anything
about the client side in production, of course.
sonja
Am Montag, den 19.09.2005, 21:48 +0200 schrieb J.Pietschmann:
> Sonja Löhr wrote:
> > With IE (that is, acrobat inside) I get sometimes the pdf and sometimes a
> > blank page, after reloading the message about a "damaged file". Firefox
> > (always) complains that the file "doesn't begin with %PDF-" (ok, indeed both
> > speak German ;-)
>
> The browser explicitly asks if it will accept a compressed
> response. The server is *not* allowed to use compression (at the
> HTTP level) if the browser doesn't ask for it. Check your browser
> configuration. In Firefox, you might try the HTTP live headers
> extension for sniffing the actual values.
>
> Also, most of the PDF parts are already compressed (and re-encoded
> as ASCII85). A secondary compression will probably gain something
> between 15% and 20% for typical PDF files. Significant improvements
> are only to be expected in case of large embedded BMP images and in
> some cases if there are large embedded fonts.
>
> J.Pietschmann
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
--
Sonja Löhr <so...@arcor.de>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: compressing pdf response
Posted by JB...@s-s-t.com.
J.Pietschmann wrote:
Also, most of the PDF parts are already compressed (and re-encoded
as ASCII85). A secondary compression will probably gain something
between 15% and 20% for typical PDF files. Significant improvements
are only to be expected in case of large embedded BMP images and in
some cases if there are large embedded fonts.
----------------------------------------------------------------------------------------------------
I use FOP to prepare some documents that contain no images and use only
the standard fonts. The other day, I thought I'd zip one of those files
before sending it to a customer, and I got a 4% gain. I sent the unzipped
PDF file rather than make the customer unzip the file.
YMMV
Jay Bryant
Bryant Communication Services
(presently consulting at Synergistic Solution Technologies)
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: compressing pdf response
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Sonja Löhr wrote:
> With IE (that is, acrobat inside) I get sometimes the pdf and sometimes a
> blank page, after reloading the message about a "damaged file". Firefox
> (always) complains that the file "doesn't begin with %PDF-" (ok, indeed both
> speak German ;-)
The browser explicitly asks if it will accept a compressed
response. The server is *not* allowed to use compression (at the
HTTP level) if the browser doesn't ask for it. Check your browser
configuration. In Firefox, you might try the HTTP live headers
extension for sniffing the actual values.
Also, most of the PDF parts are already compressed (and re-encoded
as ASCII85). A secondary compression will probably gain something
between 15% and 20% for typical PDF files. Significant improvements
are only to be expected in case of large embedded BMP images and in
some cases if there are large embedded fonts.
J.Pietschmann
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
RE: compressing pdf response
Posted by Sonja Löhr <so...@arcor.de>.
Hi, Carol!
Thank you. This is exactly the code I use :-)
With IE (that is, acrobat inside) I get sometimes the pdf and sometimes a
blank page, after reloading the message about a "damaged file". Firefox
(always) complains that the file "doesn't begin with %PDF-" (ok, indeed both
speak German ;-)
> -----Original Message-----
> From: cgray [mailto:cgray@berkeley.edu]
> Sent: Montag, 19. September 2005 18:58
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: compressing pdf response
>
> Hi Sonja,
> The article below, by Jason Hunter, discusses creating a
> filter to handle compression. It also has links to samples to
> download.
> I haven't used this, but it looks like it might be of help.
>
> Carol
>
>
> http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters-p3.html
>
> Sonja Löhr wrote:
>
> >Hi!
> >
> >This is not a FOP question, but you I'm sure you are familiar with
> >these things I use FOP in a servlet and would like to add a
> >CompressionFilter since the output pdf is very large.
> >I tried to get the output with firefox and IE the Browsers cannot
> >handle the output. (IE sometimes (?) can, firefox never.
> >
> >The actual compression is that one:
> >
> >gzipstream = new GZIPOutputStream(output);
> >flushToGZip();
> >response.addHeader("Content-Encoding", "gzip");
> >response.setContentType("application/pdf");
> >
> >I added the last line since I hoped it could help
> (additionally), but
> >it doesn't. Is there something else I could try to configure
> on any of
> >the Streams concerned?
> >
> >Before compressing, both browsers pass a test whether
> compressed data
> >are accepted.
> >
> >Thanks for you help again!
> >
> >sonja
> >
> >
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> >For additional commands, e-mail:
> fop-users-help@xmlgraphics.apache.org
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: compressing pdf response
Posted by cgray <cg...@berkeley.edu>.
Hi Sonja,
The article below, by Jason Hunter, discusses creating a filter to
handle compression. It also has links to samples to download.
I haven't used this, but it looks like it might be of help.
Carol
http://www.javaworld.com/javaworld/jw-06-2001/jw-0622-filters-p3.html
Sonja Löhr wrote:
>Hi!
>
>This is not a FOP question, but you I'm sure you are familiar with these
>things
>I use FOP in a servlet and would like to add a CompressionFilter since the
>output pdf is very large.
>I tried to get the output with firefox and IE the Browsers cannot handle the
>output. (IE sometimes (?) can, firefox never.
>
>The actual compression is that one:
>
>gzipstream = new GZIPOutputStream(output);
>flushToGZip();
>response.addHeader("Content-Encoding", "gzip");
>response.setContentType("application/pdf");
>
>I added the last line since I hoped it could help (additionally), but it
>doesn't. Is there something else I could try to configure on any of the
>Streams concerned?
>
>Before compressing, both browsers pass a test whether compressed data are
>accepted.
>
>Thanks for you help again!
>
>sonja
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org