Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
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.

share|improve this answer
+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 '12 at 13:50

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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