Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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  
+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

 
discard

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.