惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
B
Blog RSS Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
Y
Y Combinator Blog
月光博客
月光博客
IT之家
IT之家
T
Tailwind CSS Blog
Last Week in AI
Last Week in AI
L
LangChain Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
P
Proofpoint News Feed
博客园 - Franky
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
V
Visual Studio Blog
小众软件
小众软件
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
PDF Is Still the Hardest File Format to Work With. Here's...
hiyoyo · 2026-04-29 · via DEV Community

All tests run on an 8-year-old MacBook Air.

I've spent months building a PDF tool. PDF is the most infuriating file format I've ever worked with.

Not because it's poorly designed. Because it's been accumulating complexity since 1993 and the spec is 750 pages long.


It's not a document format. It's a programming language.

PDF files contain operators, operands, a stack-based execution model, and a coordinate system. A "page" is a program that draws itself.

BT                    % Begin text
/F1 12 Tf            % Set font F1 at 12pt
100 700 Td           % Move to position
(Hello, World.) Tj   % Draw text string
ET                    % End text

Enter fullscreen mode Exit fullscreen mode

That's not markup. That's code. Parsing it correctly requires implementing an interpreter.


Font handling will break you

Fonts in PDF come in 9 different subtypes. Each has different encoding rules.

Type1, TrueType, OpenType, CIDFont Type0, CIDFont Type2, Type3, MMType1, CIDFontType0C, CIDFontType2...

A scanned PDF from a 2003 copier might use a custom encoding table that maps byte values to glyph IDs in a way that made sense to that specific device in 2003.

Text extraction from these files produces garbage unless you implement the full encoding resolution chain. Most libraries don't.


"Deleted" content isn't deleted

PDF uses an incremental update model. When you edit a PDF, the original objects stay in the file. New objects are appended, and the XREF table is updated to point to the new versions.

The old versions are still in the bytes. They're just not indexed.

[Original PDF bytes]
[Updated object - new version of page 1]
[New XREF table pointing to updated objects]
%%EOF

Enter fullscreen mode Exit fullscreen mode

A forensic tool (or a hex editor) can read the original content. This is why "save as" doesn't erase metadata.


The spec is advisory, not enforced

PDF viewers are so permissive that malformed PDFs became common. Files that violate the spec in multiple ways open fine in Adobe Reader, so nobody fixed them.

Now every PDF parser has to handle malformed files gracefully, because real-world PDFs are full of spec violations.

lopdf will fail on files that Adobe Reader opens without complaint. You end up writing recovery code for files that technically shouldn't exist.


None of this is a reason not to work with PDFs.

It's a reason to understand what you're getting into before you start.

The complexity is why good PDF tools are worth building — and why nobody has fully solved it yet.


Hiyoko PDF Vault → https://hiyokoko.gumroad.com/l/HiyokoPDFVault
X → @hiyoyok