A call with my wife
This happened a few minutes ago, I got a call from an unknown number. That was my wife’s work number, and she called to ask me an urgent question, it seems:
“Can you tell me how to compress a PDF file?” she asked.
For the next part, it might be better if I paint you the whole picture. Imagine bullet time, where everything slows down, and I start to analyze the question and my possible answer. The following thoughts run through my mind during that time.
- PDF files are already compressed by default.
- Pretty sure that the file format is already using compression.
- You could strip unneeded elements from the file, removing fonts is one example, I think.
- If there are images, can probably downscale or re-sample them to reduce their size.
- What about just running this through Zip?
- Where did this question come from?
That took about two seconds in real time. The decision tree for any possible answer here grew exponentially. I had to make a call.
“No, that isn’t easily possible,” I answered.
I got some more details as well.
“This is for uploading a document to the XYZ system, it only accepts up to 4MB files, but this PDF is 5.5MB. I guess I can just scan this document as two separate pages instead of one, right?”
A workaround found, and a detailed dive into lossless vs. lossy compression compared to the file format choice avoided, I agreed that this was probably the best option and finished my coffee, pondering the ethical dilemma of answering the actual question or the intended question.
Comments
Sometimes a quick search can save you a lot of time. This online tool from Adobe can make a PDF file 50% to 400% smaller.
https://acrobat.adobe.com/link/acrobat/compress-pdf?x_api_client_id=adobe_com&x_api_client_location=compress_pdf
As a developer, I have also been known to overthink things.
The PDF format supports appending changes to the file to speed things up. So if for example you delete elements, it could just append that fact to the end of the file so it actually gets a bit bigger, not smaller. "Compressing" would be possible then, but it is a bit like defragmenting or vacuuming as opposed to actual compression.
Having recently had to answer this same question, there are a few tools that can help compress PDF files. They mostly optimize the images, and maybe strip out other data that’s not essential.
Someone already mentioned that Adobe provide an online tool, and Acrobat can also do this if you have an Adobe subscription.
macOS also has a PDF compressor into its Preview app.
There’s a few other tools out there if you google compress PDF too.
Comment preview