Complete PDF Guide

Merge, split, compress, rotate, watermark, encrypt, number, rasterise — everyday PDF work follows a pattern. This guide organises 14 operations by what they do, when to use them and what to watch out for, plus an A-series page size chart at every common DPI.

How It Works

PDF (Portable Document Format) packs text, fonts, vector art and images into a fixed-layout file that looks identical on any device — the key difference from flow-based documents like Word.

A PDF is built from objects (pages, fonts, content streams) plus a cross-reference table; a text PDF lets you select and copy, while a scanned PDF is essentially an image needing OCR to extract words. It fits contracts, reports and ebooks where "what you see is what you get".

When to Use This Table

This table is for operations on PDFs such as merging, splitting, encrypting, compressing and watermarking. It lists what each operation does, when to use it and what to watch out for. Establish which kind of PDF you have first — scanned and electronic documents follow entirely different paths.

When not to consult it: you are implementing PDF internals (parsers, stream objects, font embedding) or designing a document system. This page covers everyday operations on existing PDFs, not specification internals.

Rule of thumb: distinguish electronic from scanned documents. An electronic PDF has a real text layer that can be copied, searched and edited. A scan is an image with an OCR-guessed text layer, so search misses characters and editing breaks. Any content editing requires OCR first, and OCR quality caps everything downstream.

Mind that PDF encryption comes in two forms: the owner password (needed to open) and the permissions password (restricts printing and copying while the file still opens). "Cannot open the document" and "opens but cannot copy" are different problems — establish which one you have before debugging.

Boundaries and Common Pitfalls

  • Running text operations on scans yields subtly wrong results

    A scanned PDF text layer comes from OCR at typically 85–98% accuracy, with errors concentrated in rare characters, punctuation and digits. The consequences: searching for lO1 misses what should match 101, and copying OCR text into a data pipeline yields corrupted identifiers. Practical advice: OCR first and manually spot-check critical fields such as amounts, identifiers and dates before any batch operation; for archival search use image-level search rather than relying on the text layer.

  • Images dominate PDF size; text is nearly free

    In a 20MB scanned PDF, 19MB may be images while the text layer is only tens of kilobytes. Running a generic "compress document" pass over fonts and structure changes little. The effective move is to recompress the embedded images: reduce 300dpi to 150dpi or replace PNG with lossy JPEG, saving 60–80% with almost no visible difference. Choose an image-compression option rather than a document-compression one, since many tools default to the latter.

  • Merging and splitting break bookmarks and internal links

    Merging with a simple tool drops or scrambles the original bookmarks, table of contents, form field values and internal links — after merging, a bookmark may point at the wrong page. The robust approach is a tool that preserves the outline, and then verifying every bookmark and link afterwards; if documents cross-reference each other, prefer offering separate PDFs with an index in a web page or document system rather than merging.

How This Relates to Neighbours

To perform these operations directly, use the in-site PDF tools; this page is about method choice and risk.

PDF/A and accessible (tagged) PDF requirements are document standards, out of scope here.

Handling OCR for scans involves language models and post-processing, a separate technical topic.

If the goal is debugging a failed PDF operation, first establish whether the document is electronic or scanned, and whether encryption is an open password or a permissions password.

Practical Snippet

Key points: (1) distinguish electronic from scanned documents — a scan text layer is OCR-guessed at 85–98% accuracy so search misses and copied identifiers are corrupted, and any content editing needs OCR with manual spot-checks of amounts and identifiers first; (2) compressing a PDF means recompressing images (300dpi to 150dpi, PNG to lossy JPEG, saving 60–80%) rather than the document structure, since images are about 95% of a scan; (3) encryption comes as an open password or a permissions password, and cannot-open is a different problem from opens-but-cannot-copy; (4) merging and splitting break bookmarks and internal links, so verify every bookmark page after merging — out-of-range numbers mean the mapping is wrong.

// ① 判断 PDF 类型:是扫描件还是电子件
// 扫描件几乎没有可提取的文字对象
async function pdfKind(file) {
  const buf = new Uint8Array(await file.arrayBuffer())
  const text = new TextDecoder('latin1').decode(buf)
  const hasFont = //Font/.test(text)
  const hasImage = //Subtypes*/Image/.test(text)
  const pageCount = (text.match(//Types*/Page[^s]/g) || []).length
  // 有 Image 但无 Font ⇒ 大概率是扫描件(图片 + 极少的 OCR 文字层)
  return { pageCount, hasFont, hasImage, likelyScanned: hasImage && !hasFont }
}

// ② 压缩:压图片而不是压文档结构
// ✅ 有效:300dpi → 150dpi,PNG → 有损 JPEG(体积降 60–80%)
// ❌ 无效:只做 "compress document"(字体与结构本来就只占几十 KB)
const COMPRESS_OPTIONS = {
  imageDpi: 150,        // 300 → 150,文字型 PDF 可再降到 100
  jpegQuality: 0.75,    // 0.6–0.8 之间肉眼几乎无差
  removeMetadata: true, // 元数据通常只占几 KB
  // ❌ 不要启用 "optimize for web" 之类会降文字清晰度的选项
}

// ③ 加密分两种,问题不同
// 打开密码:不给就打不开
function encryptWithOpenPassword(doc, pwd) {
  return { userPassword: pwd, ownerPassword: pwd, allowPrint: true, allowCopy: false }
}
// 权限密码:不给也能打开,但限制操作
function encryptWithPermissions(doc) {
  return { userPassword: '', ownerPassword: '', allowPrint: false, allowCopy: false }
}
// 排查「打不开」还是「不能复制」,先分清是哪一种

// ④ 合并:结构化操作 + 合并后校验书签
async function mergeSafely(files) {
  const merged = await mergePreservingOutline(files)
  // 🔴 书签可能指向错误的页码 ⇒ 合并后必须逐个检查
  const outline = await readOutline(merged)
  const pageCount = await countPages(merged)
  const broken = outline.filter(item => item.page > pageCount)
  if (broken.length) {
    console.warn('书签越界:', broken)    // 越界说明页码映射错了
  }
  return { doc: merged, brokenBookmarks: broken.length }
}

// ⑤ 扫描件:OCR 后抽查关键字段再批量处理
const CRITICAL_FIELDS = ['amount', 'invoice_no', 'date']   // 金额/编号/日期
function shouldSpotCheck(text) {
  return CRITICAL_FIELDS.some(f => text.includes(f))
}
// OCR 准确率通常 85–98%,错误集中在低频字符、标点与数字上

Practical Notes

  • Compressing and shrinking a PDF are not the same operationLossy image downsampling shrinks a lot but degrades sharpness, while removing redundant objects and de-duplicating fonts is lossless and depends on file structure. Print-bound documents should not have images crushed blindly; decide the purpose first.
  • Normalize page size and orientation before mergingMixing A4 and Letter causes clipped content or uneven margins, because most libraries treat the first page as the reference and place others at their native size. Normalize or scale explicitly before merging.
  • Encryption and permissions are separate settingsAn open password controls whether the file can be opened; a permissions password controls copy, print and edit. Files with only a permissions password are widely ignored by viewers, so genuinely confidential documents need an open password.

Data Sources

  • ISO 32000-2 (PDF 2.0)
  • PDF Association technical notes

Codes, names and definitions above come from public specifications; we claim no originality over the specification data itself. The arrangement, Chinese annotations and practical notes on this page are written by us.

14 Common PDF Operations

OperationWhat It DoesTypical UseWatch Out
MergeConcatenate several PDFs in orderContract bundles, report collections, invoice archivingOrder determines page numbers; unify page sizes first
SplitBreak a PDF by page range or one page per fileDistributing single-page receipts, splitting scansRanges are 1-based, inclusive on both ends
CompressResample images and drop redundant objectsEmail attachment limits, faster page downloadsText-heavy vector PDFs have little room to shrink
RotateRotate whole pages by 90/180/270 degreesFixing sideways pages from phone scansChanges the display matrix only, not text flow
WatermarkOverlay translucent text or an imageMarking drafts, internal copies, copyright noticesWatermarks are removable; not an access control
EncryptSet a user password and an owner passwordStatements and payslips containing personal dataUse AES-256; RC4 is considered insecure
DecryptRemove the open restriction when you know the passwordClearing your own password before bulk archivingOnly use on files you are legally entitled to open
Page NumbersAdd footer numbers or "Page N of M"Tenders, theses, print-ready draftsMind the offset if you have a cover and TOC
Delete PagesRemove chosen pages and renumberDropping blank scans and erroneous pagesConfirm page numbers first; the action is irreversible
ReorganiseDrag pages into a new orderInserting missed pages, reordering chaptersCombine with merge and delete for full cleanup
ExtractPull out text, images or selected pagesCopying clauses from a contract, exporting figuresScanned files need OCR before text extraction works
To ImageRasterise each page to PNG/JPEG at a chosen DPIEmbedding in slides, web previews, thumbnails72 DPI for screens, 300 DPI for print
CropTrim margins or crop to a regionRemoving scan borders, unifying the text blockPDF cropping usually hides rather than discards
SignAdd a handwritten or image signature; verify digital signaturesSigning contracts back, acceptance formsAn image signature is not a digital signature

Page Sizes and Pixel Dimensions

PDF internally uses 72 DPI PDF points, so an A4 page is 595 × 842 points at native scale. The table lists three resolutions commonly used when rasterising.

SizeMillimetresInches72 DPI96 DPI300 DPI
A4210 × 2978.27 × 11.69595 × 842794 × 11232480 × 3508
A5148 × 2105.83 × 8.27420 × 595559 × 7941748 × 2480
A3297 × 42011.69 × 16.54842 × 11911123 × 15873508 × 4961
B5176 × 2506.93 × 9.84499 × 709665 × 9452079 × 2953
Letter216 × 2798.5 × 11612 × 792816 × 10562550 × 3300
Legal216 × 3568.5 × 14612 × 1008816 × 13442550 × 4200

Frequently Asked Questions

Why does compressing a PDF barely reduce its size?

PDF size is dominated by embedded images, fonts and scanned bitmaps. A file that is mostly vector text with a few images simply has little to reclaim; the real weight is usually full-page scans. To shrink those you must re-export at a lower scan DPI or accept image-quality loss from image-oriented compression.

What DPI should I use when converting PDF to images?

Use 96–150 DPI for on-screen reading, embedding in slides or web previews. Use 200 DPI when small text must stay legible or the image will be re-laid out. Reserve 300 DPI for print. Doubling DPI doubles both pixel dimensions, so file size grows roughly fourfold — do not simply pick the maximum.

Does PDF encryption stop people from copying content?

Only against casual users. A user (open) password genuinely blocks anyone without it. An owner password merely sets a permission flag: most viewers honour it, but many tools ignore it outright. Do not rely on PDF permission bits to protect genuinely confidential material.

What is PDF/A and how does it differ from a normal PDF?

PDF/A is a subset of PDF designed for long-term archiving. It requires all fonts to be embedded, forbids encryption and JavaScript, and removes dependencies on external resources, so the file still renders correctly decades later. Normal PDFs optimise for editing and interactivity; PDF/A optimises for stable reproduction, and is typically required for archives, invoices and contract storage.