A twenty-page PDF weighing forty megabytes will not go through as an email attachment, slows down uploads to a portal and takes up archive space for nothing. The problem is almost never the text, which weighs very little, but what surrounds it. Before relying on an online compression service, to which you might be handing a confidential document, it is worth understanding where the weight comes from and acting at the source.
Where the weight comes from
The main causes, in order of frequency:
- High-resolution images. A smartphone photo inserted into a document keeps all its pixels, even if it is shown the size of a postage stamp.
- Colour scans. A page scanned in colour at high resolution can weigh as much as an entire textbook.
- Fully embedded fonts. Normally only the characters used are embedded; some exports include the whole set.
- Duplicated content. The same logo repeated on every page, if the program does not recognise it as identical, is saved several times.
- Hidden data. Layers, thumbnails, previous versions saved incrementally, metadata from graphics programs.
To work out which case applies, a quick check is enough: if the file opens slowly and while scrolling you see images appear in blocks, the cause is almost certainly the images.
What resolution you really need
| Destination | Indicative image resolution |
|---|---|
| On-screen reading, email | 100-150 ppi |
| Office printing | 200-300 ppi |
| Professional printing | 300 ppi or more, as the printer specifies |
| Text-only scan | 200-300 dpi in black and white or greyscale |
The principle is simple: beyond the resolution the target device can show, extra pixels are just weight.
Acting at the source
The cleanest solution is to produce a PDF that is already light:
- Word: in the advanced options you can set the default image resolution; Picture Format › Compress Pictures reduces those already inserted and deletes cropped areas, which otherwise stay in the file.
- LibreOffice: in the PDF export dialog you choose JPEG compression with a quality setting and enable reducing image resolution to a specific value.
- Scans: scan in black and white or greyscale when colour is not needed, and enable text recognition. It is often the single change that saves the most.
- Images: resize them before inserting them. An image 4000 pixels wide in a 15-centimetre column is wasted.
Compressing an existing PDF with Ghostscript
When the source is not available, Ghostscript, free and available for every system, reprocesses the PDF:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.7 \
-dPDFSETTINGS=/ebook \
-dNOPAUSE -dQUIET -dBATCH \
-sOutputFile=light.pdf original.pdf
The -dPDFSETTINGS option selects a predefined profile:
/screen: the most aggressive, low-resolution images; suitable only for on-screen viewing./ebook: a good compromise for documents to be read and printed in the office./printerand/prepress: high quality, modest reduction.
Always work on a copy and check the result: Ghostscript recreates the file, and in some cases it can lose elements such as form fields, digital signatures or the tag structure for accessibility. On a digitally signed document, any reprocessing invalidates the signature.
Other useful operations
- Remove useless pages: blank pages and duplicate attachments are pure weight.
- Use «Save As» instead of «Save» in PDF programs: some append changes to the file, which grows with every save.
- Linearise the PDF for the web with tools such as qpdf (
qpdf --linearize in.pdf out.pdf): it does not reduce the size, but it lets the first page display before the whole file has downloaded.
What not to do
Converting a text PDF into images, «printing» it as a scan, sometimes reduces the size but destroys selectable text, search and accessibility. It is a worse solution than the problem. Likewise, compressing a file with JPEG several times in a row worsens quality at every pass without large savings.
In my work I prefer to regenerate the PDF from the source document with the right settings: it takes a minute and always gives the best result.
In short
- A PDF's size almost always depends on images and scans, not on the text.
- For screens 100-150 ppi is enough; for office printing 200-300.
- Acting in the source, compressing and resizing images, gives the best results.
- Ghostscript with the
/ebookprofile slims down existing PDFs, but use it on a copy. - Avoid turning text into images and recompressing several times.