File types · Explainer

The PDF file (.pdf)

A PDF file is a document that looks the same on every screen and printer, with its fonts, images and layout fixed in place. This guide explains what's inside one, how readers open it, the quirks worth knowing, and has free sample PDF files to download for testing.

At a glance

Full name
Portable Document Format
Extensions
.pdf
MIME type
application/pdf
Kind
Binary, fixed layout: text-based objects plus compressed data streams
Standard
ISO 32000-2 (PDF 2.0), maintained by ISO; created by Adobe
First released
1993, by Adobe
Opens with
Any web browser, Adobe Acrobat Reader, Preview on a Mac
Magic number
25 50 44 46 2D (%PDF-), then the version, e.g. %PDF-1.7
Units
Points, 1/72 of an inch: an A4 page is about 595 × 842
Subsets
PDF/A for archiving, PDF/UA for accessibility, PDF/X for print

The basics

What is a PDF file?

A PDF is a digital printout. It records exactly where every letter, line and picture goes on each page, and carries the fonts and images it needs, so the document looks the same on a phone, a laptop and a printer, years later and in any app. Adobe created it in 1993, and it has been an open ISO standard since 2008.

That's why PDF is the format for anything that must not change shape: contracts, invoices, forms, manuals, papers, CVs, tickets, boarding passes and print-ready artwork. Most programs can save or print to PDF, and every major browser can display one.

Besides text and pictures, a PDF can hold:

  • Links and bookmarks for moving around the document and out to the web.
  • Fillable forms: text boxes, check boxes, drop-down lists and signature fields.
  • Comments and highlights (annotations) added on top of the page.
  • Attachments: other files embedded inside the PDF.
  • Digital signatures that show who signed it and whether it changed afterwards.
  • Structure tags that tell screen readers the reading order, headings and table cells.

What a PDF doesn't do well is change. It describes finished pages, not flowing text, so it doesn't reflow to fit a small screen, and editing it is much harder than editing the document it came from. Keep the original (a Word file, a design file) if you'll need to make changes.

Anatomy

What's inside a PDF file

A PDF is a set of numbered objects (dictionaries, arrays, text strings, numbers and data streams) plus a table saying where each one starts. Most PDFs compress their streams, so they look like noise in a text editor. This one, our sample-minimal.pdf, doesn't: here is all 670 bytes of it, part by part.

sample-minimal.pdf
%PDF-1.7
%âãÏÓ
1 0 obj
<< /Type /Catalog /Pages 2 0 R >>
endobj
2 0 obj
<< /Type /Pages /Kids [3 0 R] /Count 1 >>
endobj
3 0 obj
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 595 842]
   /Resources << /Font << /F1 5 0 R >> >>
   /Contents 4 0 R >>
endobj
4 0 obj
<< /Length 113 >>
stream
BT
/F1 24 Tf
72 770 Td
(Hello, world.) Tj
/F1 11 Tf
0 -28 Td
(Sample PDF from 99helpers.com/file-types/pdf) Tj
ET
endstream
endobj
5 0 obj
<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>
endobj
xref
0 6
0000000000 65535 f 
0000000015 00000 n 
0000000064 00000 n 
0000000121 00000 n 
0000000253 00000 n 
0000000417 00000 n 
trailer
<< /Size 6 /Root 1 0 R >>
startxref
487
%%EOF
  1. 1%PDF-1.7

    The header

    Every PDF starts with %PDF- and a version number. These are the bytes programs check to recognise the format.

  2. 2%âãÏÓ

    The binary marker

    % starts a comment. Four bytes above 127 (here E2 E3 CF D3, shown as Latin-1) tell transfer tools to treat the file as binary, so they don't alter line endings and break it.

  3. 31 0 obj … endobj

    The catalog

    The root of the document. 1 0 is the object number and generation; 2 0 R is a reference to object 2.

  4. 4<< /Type /Pages /Kids [3 0 R] /Count 1 >>

    The page tree

    Lists the pages in order. Large documents nest these nodes so a reader can find page 500 without reading 499 others.

  5. 5/MediaBox [0 0 595 842]

    A page

    The page size in points (1/72 inch): 595 × 842 is A4. The page also names its resources (fonts, images) and its content stream.

  6. 6<< /Length 113 >> stream

    A stream

    Raw data with its length in bytes. In most files it's compressed with /Filter /FlateDecode, the same deflate method ZIP and PNG use.

  7. 7BT /F1 24 Tf 72 770 Td (Hello, world.) Tj ET

    Drawing instructions

    Begin text, pick font F1 at 24 points, move to x 72, y 770 (measured from the bottom-left corner), show the string, end text. There are no paragraphs: every line is placed at exact coordinates, which is why reflowing or editing PDF text is hard.

  8. 8/BaseFont /Helvetica

    A font

    Helvetica is one of 14 standard fonts that readers supply themselves, so it isn't embedded. Real documents usually embed their fonts, or a subset of them.

  9. 9xref … 0000000015 00000 n

    The cross-reference table

    The byte offset of every object: object 1 starts at byte 15. Each entry is exactly 20 bytes. Change one character earlier in the file and the offsets are wrong, which is why editing a PDF in a text editor usually breaks it (good readers repair it on the fly).

  10. 10trailer << /Size 6 /Root 1 0 R >>

    The trailer

    Says how many objects there are and which one is the catalog. Encrypted files also point to their encryption settings here.

  11. 11startxref 487 %%EOF

    The end

    A reader starts at the end of the file: startxref gives the byte where the cross-reference table begins, and %%EOF marks the end.

Under the hood

How a PDF reader opens the file

  1. 1It checks the header for %PDF- and the version.
  2. 2It jumps to the end and reads startxref, which gives the position of the cross-reference table (or, in newer files, a compressed cross-reference stream).
  3. 3It reads the trailer to find the catalog, the root object, and from there the page tree.
  4. 4It loads only what it needs: to show page 7 it fetches that page's content stream, fonts and images by their byte offsets, not the whole file.
  5. 5It runs the page's drawing instructions: place this text, stroke this line, paint this image, decompressing each stream on the way.

Three features explain a lot of real-world behaviour:

  • Incremental updates. When an app saves changes, it can append the new objects and a new cross-reference table to the end instead of rewriting the file. The old content is still inside. That makes saving fast and keeps signatures valid, but also means deleted text can sometimes be recovered.
  • Linearisation ("Fast Web View"). The objects for the first page are moved to the front, with a hint table, so a browser can show page 1 while the rest is still downloading.
  • Compression. Streams are usually compressed: FlateDecode (deflate) for text and drawings, DCTDecode for JPEG photos, which are stored as they are. Since PDF 1.5, the objects themselves can also be packed into compressed object streams.

Versions

PDF versions, and PDF/A, PDF/UA and PDF/X

The version in the header says which features a file may use. Current readers open all of them, so the version rarely matters when you open a file; it matters when an older or stricter tool has to process it.

VersionWhat it brought
PDF 1.0 (1993)The first public version, by Adobe.
PDF 1.4Transparency, and Tagged PDF: a structure layer for accessibility and text reflow.
PDF 1.5Compressed object streams and cross-reference streams, which make files smaller.
PDF 1.7Published as the ISO standard ISO 32000-1 in 2008, so anyone can implement it.
PDF 2.0ISO 32000-2, first published in 2017 and revised in 2020. It deprecates some older features, such as XFA forms, and has been free to download since 2023.

On top of the base format there are ISO subsets for particular jobs. A file in a subset is still an ordinary .pdf with the same MIME type; it declares the subset in its metadata, and a validator checks that it follows the rules.

SubsetStandardForKey rules
PDF/AISO 19005Long-term archivingAll fonts embedded; no JavaScript, no encryption, no audio or video.
PDF/UAISO 14289AccessibilityFully tagged, with a reading order, alt text for images and marked-up tables.
PDF/XISO 15930Professional printingFonts embedded, colours defined for the printing conditions, page trim size set.
PDF/EISO 24517Engineering documentsDrawings and technical documents for exchange.
PDF/VTISO 16612-2Variable printingPersonalised print runs such as bills and statements.

"Save as PDF/A" in an app doesn't guarantee a valid PDF/A. If an archive or a government portal requires one, check it with a validator such as the free, open-source veraPDF.

Comparison

PDF vs DOCX, HTML and images

PDFWord (.docx)Web page (.html)Image (.png, .jpg)
LayoutFixed pagesReflows; can shift between appsReflows to fit any screenFixed
EditingHardEasyEasy, in a text editorOnly as a picture
Text can be searched and copiedYes, unless it's a scanYesYesNo
Opens in a browserYesNo, it downloadsYesYes
Carries its fontsYes, usuallyRarelyOnly if linkedNot needed
Best forFinal documents, forms, printDrafts and collaborationReading onlinePictures and screenshots

A good habit: write and edit in DOCX or another editable format, and send or publish the final version as PDF. For long documents meant to be read on phones, an EPUB or a web page reflows better than a PDF.

Troubleshooting

Common PDF problems and how to fix them

  • I can't select or search the text. The PDF is probably a scan: each page is a picture of text, like our sample-scanned.pdf. Run OCR (optical character recognition) to add a hidden text layer. Acrobat, many scanner apps and free tools such as OCRmyPDF can do it.
  • Copied text comes out garbled or as boxes. The font inside the PDF has no table mapping its glyphs back to letters, or uses a custom encoding. Ligatures (fi, fl) and multi-column layouts also scramble copied text. OCR is often the only fix.
  • The file is huge. Usually it's full-resolution photos or scans. Use your app's reduce-size or optimise option, or re-export with lower image resolution. Many incremental saves can also bloat a file; saving a fresh copy rewrites it compactly.
  • The fonts look wrong. The fonts weren't embedded, so the reader substituted something similar. Re-create the PDF with font embedding switched on (PDF/A export forces it).
  • My filled-in form didn't keep its answers. Some viewers can display forms but can't save them, and old XFA forms only work in Adobe Acrobat or Reader. Use a reader that saves form data, or print to a new PDF to flatten the answers into the page.
  • The browser downloads it instead of showing it. The server sent Content-Disposition: attachment or the wrong Content-Type, or the browser is set to download PDFs. Served as application/pdf without the attachment header, it opens in the browser's viewer.

How to

How to open, edit and convert a PDF

  • Open it: every major browser has a PDF viewer built in, and on Windows, Microsoft Edge is the default PDF app. On a Mac, Preview opens PDFs and can also annotate, sign, reorder and merge pages. On Linux, Firefox, Evince or Okular. On iPhone and iPad, Files and Safari open them; Android phones use Google Drive or a PDF app.
  • Open at a page: add #page=5 to a PDF's web address and most browser viewers jump to page 5.
  • Edit the text: Adobe Acrobat (paid) edits PDF text directly. Microsoft Word can open a PDF and convert it into an editable document, but complex layouts shift. LibreOffice Draw handles small changes. Editing the original file and exporting again is almost always better.
  • Make a PDF: choose Print and then "Save as PDF" (macOS, Chrome) or "Microsoft Print to PDF" (Windows). Word, LibreOffice, Google Docs and Pages export PDF directly, with links and headings kept.
  • Merge, split, rotate or unlock: Preview on a Mac, or the free command-line tool qpdf (qpdf --empty --pages a.pdf b.pdf -- merged.pdf).
  • Get the text out: pdftotext from the free Poppler tools, or copy and paste from a viewer.
  • Share it: rather than attaching a large file, put it online and send a link, or embed it in a web page.

Security

Is it safe to open a PDF? And what can it reveal?

A PDF is not a program, but it can contain things that act:

  • JavaScript. Adobe Acrobat and Reader run scripts embedded in a PDF, mainly for forms. Browser viewers support little or none of it. Attackers have used scripts to exploit bugs in readers, so keep your reader up to date.
  • Embedded files and launch actions. A PDF can carry attachments, including programs, and ask the reader to open them. Readers warn before doing so; say no unless you expected it.
  • Links. The most common PDF attack today is the simplest: a document with a convincing button that leads to a fake sign-in page.

PDFs also leak information their authors didn't mean to share:

  • Fake redaction. A black box drawn over text hides it on screen, but the text is still there and can be copied. Use a real redaction tool, which removes the content, then check by searching for the hidden words.
  • Metadata. Author name, company, software and dates are stored in the file. Check the document properties before publishing.
  • Old versions. Because of incremental updates, earlier content can survive inside the file. Saving a new copy ("Save As", or printing to PDF) leaves it behind.

Two kinds of password

An open password encrypts the content: without it the file can't be read. A permissions password only asks software not to allow printing, copying or editing. Anyone who can open the file can remove those restrictions with common tools, so don't rely on them to protect anything.

Free downloads

Sample PDF files to download

Free sample PDF files for testing viewers, uploads, text extraction, forms and passwords. Each one passes qpdf --check and opens with the Poppler PDF tools.

sample-document.pdf · 70.6 KBDownloadOpen

What's inside sample-document.pdf

A three-page A4 document with the features most real PDFs have. Open it in your viewer, then look for each of these.

  1. Document information

    Title, author, subject, keywords and dates, stored twice: in the classic document information dictionary and in an XMP metadata stream. Your viewer shows them under document properties.

  2. Bookmarks

    An outline with one entry per section. The file asks the viewer to open with the bookmarks panel showing (/PageMode /UseOutlines).

  3. Embedded font subsets

    DejaVu Sans and DejaVu Sans Bold, embedded with only the characters used. The AAAAAA+ prefix in the font names marks a subset. Each font has a ToUnicode map, so copied text comes out as real letters.

  4. Real text in several scripts

    Greek, Cyrillic, accented Latin and symbols such as € and ✓. Search for "Ελληνικά" to check your viewer's search.

  5. A table and a vector chart

    The table on page 2 is only text and lines at fixed positions; the file is not tagged. The bar chart is drawn with path operators, so it stays sharp at any zoom.

  6. A raster image

    A 480 × 240 pixel JPEG on page 3, embedded as it is with the DCTDecode filter. Zoom in to see its pixels.

  7. Links

    Link annotations: one opens 99helpers.com/file-types/pdf, others jump to a section or back to page 1. A footer on every page shows the page number.

All sample PDF files

  • Three-page sample document

    sample-document.pdf · 70.6 KB (72,311 bytes)

    A realistic A4 document: metadata, bookmarks, embedded font subsets, text in several scripts, a table, a vector chart, a JPEG image and links.

    • Checking a viewer, previewer or converter
    • Text extraction and search tests
  • Minimal hand-written PDF

    sample-minimal.pdf · 670 bytes

    One A4 page, written by hand with no compression, so every object is readable in a text editor. It's the file shown in the anatomy above.

    • Learning the file structure
    • Parser and validator tests
  • Fillable PDF form

    sample-form.pdf · 55.4 KB (56,756 bytes)

    An AcroForm with text fields, radio buttons, check boxes, a drop-down list and a multi-line field, some pre-filled. Field names are printed on the page.

    • Testing form filling and saving
    • Form-field extraction in code
  • Scanned page, no text layer

    sample-scanned.pdf · 100 KB (102,400 bytes)

    One page that is only a grey-scale JPEG of a typed letter, as a scanner without OCR makes. Searching and copying find nothing. Padded to exactly 102,400 bytes with whitespace in its XMP metadata.

    • OCR and text-extraction tests
    • Upload limits at exactly 100 KB
  • Password-protected PDF

    sample-encrypted.pdf · 43.7 KB (44,723 bytes)

    Encrypted with AES-256. The open password is 99helpers. A separate permissions password limits printing to low resolution.

    • Testing password prompts and error handling
    • Checking how uploads and previews treat encrypted files
  • 1 MB PDF file

    sample-1mb.pdf · 1 MB (1,048,576 bytes)

    Three pages with a 2400 × 1600 pixel JPEG image, padded to exactly 1,048,576 bytes (1 MiB) with whitespace in its XMP metadata.

    • Upload limits and timeouts
    • Download progress and large-image rendering

Ways to test with them

  • Upload limits: sample-scanned.pdf is exactly 102,400 bytes and sample-1mb.pdf exactly 1,048,576 bytes, so you can test a limit at the boundary.
  • Text extraction: run pdftotext or your own code on sample-document.pdf and sample-scanned.pdf. The first returns the text; the second returns nothing, which is what a pipeline should detect before it needs OCR.
  • Forms: fill in sample-form.pdf, save, close and reopen it. If the answers are gone, the viewer can show forms but not save them.
  • Passwords: open sample-encrypted.pdf with a wrong password, then with 99helpers. A good app asks again rather than failing silently or crashing.
  • Structure: sample-minimal.pdf is small enough to read in a text editor and compare with the anatomy above, byte by byte.

Free to use for testing, teaching and demos, commercially or not, with no attribution needed. A link back to this page is always appreciated.

Put it online

Have a PDF? Give it a link.

Drop a PDF on 99helpers and it gets its own web address. Most browsers open it straight in their built-in PDF viewer, so people can read it without an attachment or an app.

Questions

PDF files, frequently asked

What does PDF stand for?

Portable Document Format. "Portable" because the file looks the same on any device, operating system or printer.

How do I open a PDF file?

Double-click it, or drag it into a browser window: Chrome, Edge, Firefox and Safari all have a PDF viewer built in. Adobe Acrobat Reader is free if you need more form and signing features.

How can I edit a PDF?

For small changes, Adobe Acrobat edits text directly, and Preview on a Mac can add text, signatures and notes. For bigger changes, edit the original document and export a new PDF. Word can convert a PDF into an editable document, but complex layouts may shift.

How do I convert a PDF to Word?

Open the PDF in Microsoft Word, which converts it into an editable document, or use Acrobat's export. Check the result: tables, columns and fonts don't always survive the conversion.

Why can't I copy or search the text in my PDF?

It's most likely a scan, where each page is a picture of text. Run OCR to add a text layer. If the text selects but pastes as nonsense, the fonts lack the information that maps their shapes back to letters.

How do I make a PDF smaller?

Images are usually the cause. Use your PDF app's reduce-size or optimise option, or export again with lower image resolution. Saving a fresh copy also removes leftovers from earlier edits.

What is PDF/A?

An ISO subset of PDF (ISO 19005) for long-term archiving. It requires embedded fonts and forbids things like JavaScript, encryption, audio and video, so the file can still be rendered correctly decades from now.

Can a PDF contain a virus?

It can contain scripts and attached files that try to exploit a reader, and links to phishing pages. Keep your reader updated, don't open attachments inside PDFs you weren't expecting, and be wary of buttons that ask you to sign in.

How do I share a PDF as a link?

Put it online. On 99helpers you drop the PDF in and get a link that opens it in the browser, which avoids attachment size limits and lets you update the file without resending it.

Related formats

Other file types explained

Keep going

Related

Sources

Last reviewed 27 October 2026.