Portable Document Format (.pdf)

ISO 标准

The Portable Document Format (PDF) is a ubiquitous digital paper standard designed to present documents consistently independent of application software, hardware, and operating systems.

将 PDF 转换为 DOCX

免费的浏览器端 PDF 转 DOCX 转换器。在您的设备上即时转换文件。

在线压缩 PDF

100% 浏览器本地私密压缩 — 文件永不离开您的设备

检查与元数据

操作系统和文件分析器通过检查开头的二进制字节序列来识别 PDF 文件:

选择或拖放文件

选择或将文件拖放到此处

100% 浏览器端私密转换 - 文件绝不会离开您的设备

或粘贴 Ctrl+V
零网络传输隐私保证: 上传至外部服务器的数据为 0 字节。所有处理均在您的浏览器沙箱中本地完成。

字节级文件头签名 (Magic Bytes)

操作系统和文件分析器通过检查开头的二进制字节序列来识别 PDF 文件:

十六进制签名 (偏移量 0):

25 50 44 46

ASCII 表示形式: %PDF

标准化: ISO 32000-1 (2008) / ISO 32000-2 (2020)

技术规格

容器架构Binary/ASCII hybrid object hierarchy with cross-reference table
压缩方式FlateDecode (Deflate), DCTDecode (JPEG), CCITT Fax, JBIG2, JPXDecode
字节序Big-Endian (network byte order) for binary object streams
色彩空间sRGB, Display P3, DeviceCMYK, Grayscale, Spot Colors (Pantone)
通道与结构Multi-layer vector, typography, raster streams, and embedded metadata
最大尺寸200 x 200 inches (UserUnit allows up to 15,000,000 inches in PDF 1.6+)
透明度Full alpha transparency, blend modes, and opacity masks
流式传输与渐进式加载Linearized PDF ('Fast Web View') allows byte-range streaming via HTTP Range requests

技术对比矩阵:PDF 对比同类产品

技术属性PDF (当前)DOCXEPUBHTML5
Visual Layout FidelityPixel-perfect fixed geometric layout across all screens and printersFlow-based; varies across Word versions and installed fontsReflowable reader layout; no fixed typography guaranteesFluid CSS box model; screen-dependent rendering
Self-Containment100% self-contained with embedded fonts, raster streams, and vector assetsSelf-contained XML container (system fonts usually un-embedded)Self-contained ZIP container (packaged XHTML/CSS assets)Requires external HTTP resources unless packaged via MHTML
Cryptographic SignaturesNative PAdES and X.509 cryptographic digital signatures built into ISO specOffice XML DSig digital signatures supportedRequires custom digital container signaturesRequires Web Crypto API or external TLS transport guarantees
Mobile ResponsivenessFixed-page canvas (requires zooming and panning on small screens)Excellent responsive text reflowEngineered specifically for fluid mobile e-readingNative responsive layout with CSS media queries
StandardizationOpen International Standard (ISO 32000-2:2020)ECMA-376 / ISO/IEC 29500W3C / IDPF Open StandardW3C Living Standard / WHATWG

常见损坏模式与十六进制恢复指南

⚠️ Acrobat or PDF viewer reports 'The file is damaged and could not be repaired' or opens completely blank.

根本原因: FTP or HTTP transfer in ASCII mode converted binary byte sequences (replacing 0x0A with 0x0D 0x0A), mangling the cross-reference (xref) table byte offsets.

恢复方法: Modern PDF repair utilities (e.g. qpdf --repair or File2File repair) rescan the file linearly, rebuild the object dictionary, and regenerate a new xref table.

⚠️ PDF viewer fails to load the document or crashes on the last page.

根本原因: Truncated download or incomplete disk write missing the '%%EOF' marker and trailer dictionary.

恢复方法: Inspect file tail using 'tail -c 128 document.pdf'. If missing %%EOF, verify if the root catalog object exists and append an artificial xref table pointing to the highest valid object number.

⚠️ Embedded fonts render as illegible symbols, blank blocks (.notdef), or question marks.

根本原因: Non-embedded subset fonts referencing system fonts that are missing on the viewing machine, or corrupted ToUnicode CMap tables.

恢复方法: Re-embed missing font subsets via Ghostscript (gs -o fixed.pdf -sDEVICE=pdfwrite -dEmbedAllFonts=true broken.pdf) or convert text elements to vector curves.

安全分析与解析器攻击向量

PDF is one of the most complex formats in computing, featuring active scripting, embedded files, and dynamic streams. Modern browsers sandbox PDF renderers (e.g. Chrome PDFium) in isolated processes.

已知攻击向量

  • Embedded Acrobat JavaScript (JS API) executing arbitrary code or phishing exploits upon document open.
  • Launch Actions (/Launch) configured to execute external system binaries or shell scripts.
  • Font rendering vulnerabilities in legacy Type 1 and TrueType font parsing engines triggering buffer overflows.
  • Server-Side Request Forgery (SSRF) and NTLM hash credential theft via malicious URI actions (/URI) or form submissions.

防御性最佳实践: Never open untrusted PDFs with Adobe Acrobat JavaScript execution enabled. For web viewing, always render via browser sandboxed WebAssembly/PDF.js engines, or convert untrusted PDFs to sanitized PDF/A-1b documents.

历史渊源与里程碑

2020ISO 32000-2:2020 released, formalizing modern PDF 2.0 enhancements.
2008Adobe transfers PDF specifications to the International Organization for Standardization as ISO 32000-1.
1993PDF 1.0 launched alongside Adobe Acrobat, supporting text, links, and fonts.
1991Dr. John Warnock initiates the Camelot Project at Adobe to solve digital document portability.

核心优势与特点

  • 100% universal visual fidelity across all devices, operating systems, and printers.
  • Supports digital cryptographic signatures, redaction annotations, and DRM access permissions.
  • Combines vector graphics, scalable fonts, and compressed raster streams into a single self-contained container.

技术局限与劣势

  • Fixed-layout page canvas makes automatic responsive reflowing on small smartphones challenging.
  • Complex internal object stream hierarchy can lead to bloated file sizes without compaction and unreferenced object elimination.
  • Embedded JavaScript and dynamic launch action capabilities present an expansive attack surface.

趣味技术冷知识

  • The original Camelot project paper envisioned printing documents electronically from any application directly to any display.
  • Every PDF file ends with the exact string '%%EOF' marking the end-of-file trailer.
  • Federal courts and national archives globally mandate PDF/A (ISO 19005) for long-term legal preservation.

常见技术问题

Why do PDF files look identical on every screen and printer?

PDF specifies absolute Cartesian coordinates (points at 1/72 of an inch) for every glyph, vector curve, and raster image on a fixed page canvas. Because fonts, vector paths, and color profiles are embedded directly in the container, rendering does not depend on local system fonts or printer drivers.

What is the difference between standard PDF and PDF/A?

PDF/A (ISO 19005) is a specialized subset designed for long-term archiving. It strictly bans features that could compromise future readability, such as JavaScript, external font linking, encryption, sound/video embedding, and device-dependent color spaces. All fonts and color profiles must be 100% embedded.

How does PDF compression work in modern documents?

PDF uses multiple discrete compression filters tailored to content types. Text, vector commands, and font metrics are compressed using FlateDecode (zlib/deflate). Photographic images use DCTDecode (JPEG) or JPXDecode (JPEG 2000), while bi-level monochrome scanned text uses JBIG2 or CCITT Fax Group 4 compression.

Why does a PDF file often stay large even after deleting pages or images?

When modifying a PDF, many editors perform an 'incremental update'—they append new object streams and a new xref table to the end of the file without deleting the old objects, allowing fast undo. To actually reduce the file size, the document must undergo an optimization pass that garbage-collects unreferenced objects.