ToolsWhisper

Why Is My Merged PDF So Large? What Is Inside the File

Merging does not compress anything, so a merged PDF is at least the sum of its parts. What actually makes a PDF heavy, how to find it, and what shrinks it.

Frank4 min read

You merged three small PDFs and got one file that is bigger than all of them put together. Or you combined ten scans and the result will not attach to an email. Both are normal, and neither means the merge went wrong.

Merging does not make a PDF smaller, because it does not touch the content. To see why files get large, and what actually brings them down, it helps to know what is inside one.

What a PDF is made of

A PDF is a container of numbered objects. The ones that take up space are:

  • Images. A scanned page is, usually, one large image. A phone photo placed on a page is the same photo, often several megabytes.
  • Fonts. Text only displays correctly if the font travels with the file, so fonts are embedded. Usually only the characters used are kept (a "subset"), but each file carries its own copy.
  • Content streams. The drawing instructions for each page. These are small for text and can be large for complex vector artwork.
  • Metadata and structure. Usually negligible.

For a typical business document, fonts are tens of kilobytes. For a scan, one image is most of the file.

Why merging does not shrink it

A merge copies the page objects, and everything those pages depend on, into a new document. The images are copied byte for byte. The output is therefore about the combined size of the inputs, and sometimes more.

It can be more because many tools copy each file's resources as they are. If ten files each embed their own subset of the same font, the merged file stores that font ten times. Some tools and optimisers detect and share identical objects; others do not. The same ten files merged with two different programs can come out at very different sizes, which is a frequent complaint on PDF library forums.

The other way a merged file balloons is a tool that does not copy pages at all but redraws them, for example by "printing" each one to a new PDF. That can turn crisp text into a full-page image, and a file that was 200 KB into 5 MB.

Find out what is heavy

Do not guess. If you have poppler-utils installed, two commands tell you almost everything:

pdfimages -list merged.pdf   # every image, with size, resolution and compression
pdffonts merged.pdf          # every embedded font and whether it is a subset

Look at the image list first. Pages that show an image at 300 or 600 dpi, or a long run of images that are each several megabytes, are your answer. A page of body text that is a single large image is a scan with no text layer, and it will be heavy however you merge it.

What actually shrinks a PDF

In rough order of effect:

  1. Lower the image resolution. 300 dpi is for print. For reading on a screen, 150 dpi is plenty and cuts the pixel count to a quarter.
  2. Raise JPEG compression. Quality in the 70 to 80 range is usually indistinguishable on a page of a scan.
  3. Scan text in grayscale or black and white rather than colour, when colour is not needed.
  4. Run the file through an optimiser that downsamples and re-encodes images and removes unused objects.

Ghostscript does all of this from the command line. The preset names set the target resolution:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook \
   -dNOPAUSE -dQUIET -dBATCH -sOutputFile=smaller.pdf merged.pdf

/screen targets 72 dpi, /ebook 150 dpi and /printer 300 dpi. Try /ebook first.

The arithmetic of a scan

An A4 page scanned at 300 dpi is about 2480 × 3508 pixels, roughly 8.7 million of them. In raw RGB that is around 26 MB before any compression. At 150 dpi it falls to about 6.5 MB, a quarter. JPEG compression shrinks both enormously, but the ratio between them holds: halve the resolution and each page needs roughly a quarter of the data, so twenty pages scanned at 300 dpi weigh about four times as much as the same twenty at 150.

Email limits

Many providers cap attachments at roughly 20 to 25 MB, and attachments are Base64 encoded in transit, which makes them about a third larger. A 17 MB PDF becomes about 23 MB on the wire, so a 20 MB limit can refuse it. Aim for comfortably under the nominal limit.

Better: shrink the images before you build the PDF

If you are creating the PDF from photos or screenshots, the cheapest place to save space is before the PDF exists. Resize and compress the pictures with the image compressor, then assemble them with JPG to PDF and join the result with the PDF merge tool. The images are embedded as they were, so what you put in is what you get.

One caution: JPG to PDF re-encodes your images at high quality and caps them at 4,000 pixels on the long side. That is about 340 dpi on an A4 page, which is more than most documents need, but it is not a compressor. The lever is the image you give it.

A note on what this site's tool does

The merge tool on this site copies pages as they are, so text stays selectable and nothing is redrawn. It does not recompress, which is why it will not make a file smaller. If you also need the file private, see how to merge PDFs without uploading them.

Tools used in this article

Read next