Home/Guides/PDF
πŸ“„PDF

What's Inside a PDF File (and Why It Matters When You Compress, Merge or Split One)

A PDF is a container of objects, not a picture. Here's how pages, fonts and images are stored, why sizes vary a hundredfold, and what each tool actually changes.

8 min read

A container, not a picture

Most people think of a PDF as a fixed picture of a page. It is closer to a small database. A PDF file is a collection of numbered objects β€” pages, fonts, images, streams of drawing instructions, metadata β€” plus a lookup table that says where each object lives in the file. A viewer reads the table, finds the page tree, follows each page's references to its content and resources, and draws the result. Understanding that structure explains almost every practical question about PDFs: why some are huge and some tiny, why text is selectable in one file and not another, why β€œcompressing” sometimes makes a file worse, and what merging or splitting actually does.

The four things on a page

Every page object points to some combination of these:

  • Content stream. A list of drawing commands in PostScript-like syntax: move here, set this font, show this string, fill this rectangle, place this image. Text is stored as character codes with positions, which is why a viewer can select and search it β€” and why copy-paste sometimes produces garbage when the font's character mapping is missing.
  • Fonts. Either a reference to one of 14 standard fonts every viewer must have (Helvetica, Times, Courier and variants) or an embedded font program. Good producers embed a subsetcontaining only the glyphs used; lazy ones embed the whole font, which for a CJK typeface can be 10 MB.
  • Images. Stored as XObjects with their own compression β€” DCT (JPEG) for photos, Flate (like ZIP) for screenshots and line art, JBIG2 or CCITT for black-and-white scans. The image keeps its original pixel dimensions no matter how small it is displayed on the page.
  • Annotations. Links, form fields, comments, highlights and stamps sit in a layer above the content. They can be added or removed without touching the page's drawing instructions.

Why file sizes vary so much

DocumentTypical sizeWhat dominates
10-page letter exported from Word50–150 KBOne subset font, text streams
Same letter with a full font embedded300 KB–2 MBFont program
10-page scan at 300 dpi colour10–30 MBTen uncompressed-ish images
Same scan at 200 dpi greyscale, JPEG1–3 MBImages, well compressed
Slide deck with 40 phone photos80–200 MBFull-resolution images
Vector map or CAD drawing5–50 MBMillions of path commands

The pattern is clear: text is almost free, images are almost everything. A page of text is a few kilobytes of commands; a page-sized image at print resolution is megabytes. When a PDF is unexpectedly large, the answer is nearly always an image that is far larger than it needs to be, or a font that was embedded in full.

Two ways to make a PDF smaller

Because images dominate, every compressor works on images. They differ in how.

  • Recompress the images, keep everything else. The tool finds each image XObject, downsamples it to a sensible resolution (150–200 dpi for screen and office print), re-encodes it as JPEG at a chosen quality, and writes it back. Text, fonts and vectors are untouched, so the file remains searchable and sharp. Acrobat's β€œReduce File Size”, macOS Preview's Quartz filter and Ghostscript all work this way.
  • Rasterize the whole page. The tool renders each page to a bitmap, compresses it as a JPEG, and builds a new PDF with one image per page. This is simpler, works on any input, and can shrink a scanned document dramatically β€” but text becomes pixels, vectors blur when enlarged, and a text-only document can actually get bigger. The Compress PDF tool on this site uses this approach, which is why its page says so up front.

Choose the first method when the document has real text you may need; choose the second for scans and photo collections, or when you need the smallest possible file for viewing only.

What merge, split and extract actually do

Because pages are objects that reference their resources, moving pages between documents is a copy operation, not a re-render. A merger creates a new page tree and copies each source page object along with every object it references β€” its content stream, its fonts, its images. Nothing is redrawn, so quality is identical. Two side effects follow directly from this design:

  • Shared resources get duplicated. If three source files each embed the same subset of Arial, the merged file contains three copies. Splitting a document does the reverse: each piece gets its own copy of any font it uses, so the pieces together are larger than the whole.
  • Document-level features are lost. Bookmarks (the outline), metadata like title and author, and the encryption dictionary belong to the document, not to pages. They do not travel when pages are copied into a new file. Unlocking a PDF works precisely because of this: decrypt the streams, copy the pages into a new document without an encryption dictionary, and the result is an ordinary file.

Rotation, page numbers and other stamps

Rotation is a single attribute on the page object β€” /Rotate 90 β€” that tells the viewer to turn the page when displaying it. Changing it is instant and lossless. Page numbers, watermarks and headers are appended to the content stream as extra drawing commands: embed Helvetica, move to a position, show the string β€œ7”. They become part of the page and print sharply because they are text, not pictures. This is also why a stamp cannot be cleanly removed later without a real PDF editor: it is interleaved with the original commands.

Why text is sometimes not selectable

If a PDF came from a scanner or a phone camera, each page is one large image and there is no text object to select. The file may look identical to a β€œreal” PDF but behaves completely differently: search finds nothing, copy produces nothing, screen readers read nothing, and it is ten times the size. Optical character recognition (OCR) fixes this by recognising the letters in the image and adding an invisible text layer beneath it, giving the best of both β€” the original appearance plus searchable text. Most scanner software and Acrobat offer OCR; it is worth running on any scanned document you will keep.

Practical rules of thumb

  • Export from the source application with β€œsubset fonts” and images at 150–200 dpi for documents meant for screen or office print; 300 dpi only for professional print.
  • Scan text documents in greyscale at 200 dpi, not colour at 600. Use black-and-white for pure text.
  • Resize photos before placing them in a document; a 12-megapixel image on a half-page is 90% wasted data.
  • Keep an original copy before compressing, stamping or unlocking β€” each of those rewrites the file.
  • If a file must be edited or searched later, avoid tools that rasterize.

Frequently asked questions

Is PDF an open standard?

Yes. Adobe created it in 1993 and published the specification; since 2008 it has been the ISO 32000 standard, maintained independently of Adobe. That is why hundreds of programs can read and write PDFs.

What is PDF/A?

A restricted profile for long-term archiving: all fonts must be embedded, no encryption, no external references, no JavaScript. Government archives and some courts require it. Ordinary PDFs can be converted with Acrobat, LibreOffice or Ghostscript.

Why does the same document look different in two viewers?

Usually a font that was not embedded. Each viewer substitutes its own closest match, changing spacing and line breaks. Embedding fonts on export prevents it.

Can a PDF contain a virus?

PDFs can contain JavaScript and embedded files, and malicious documents have exploited viewer bugs. Keep your viewer updated and be cautious with unexpected attachments. Browser-based tools that only copy pages, like the ones here, do not execute any scripts in the file.

What does 'linearized' or 'fast web view' mean?

A rearrangement of the objects so that the first page's data comes first in the file, letting a browser display page one while the rest downloads. It does not change the content or size.

Do browser-based PDF tools upload my file?

The tools on this site do not β€” they run pdf-lib and PDF.js in your browser and work offline once loaded. Many other online converters do upload; check the privacy statement if the document is sensitive.

Tools mentioned in this guide