I'd like to know if there's a general rule of thumb wheter to enable gzipping for PDF files or not. I use NGINX but I think this would be helpful for Apache users as well.

Thanks.

link|improve this question

67% accept rate
feedback

2 Answers

up vote 3 down vote accepted

This is just my opinion, but I think that zip-compressing PDF files is not a good idea.

PDF files will almost always use some kind compression internally, FLATE is used in general for text content inside pages, and lossy-compression is in general used for images (PNG, JPEG, JPEG2000 are common for color images and CCITT or JBIG2 are commonly used for gray-scale and monochrome). Re-compressing your files once more will provide little gain (if any) in terms of space and it will reduce the usability of the system as a whole.

link|improve this answer
1  
+1 - A properly created PDF should already be compressed. If not, then it should be modified or redistilled unless there's some mitigating factor. (e.g. must be sent through a production workflow that doesn't support compressed streams/images inside the PDF) – afrazier Apr 17 at 13:50
feedback

If your PDF files are mainly text based (few to no images) and your server has a lot of traffic accessing the same document and can handle the compressing , then yes, mod_deflate or mod_gzip is a good idea. If you're unsure, try it out first, and if the performance goes down, just undo it. I've been serving all content except images and video with mod_deflate for over a year now, and it's cut my bandwidth to under half (Lots of text documents and scripts). Also consider looking into a cache system if not already, as this will really reduce the workload on the server.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.