PDFs Without Acrobat: Do CLI Tools Cover Everything?
In this article
- Background: Why the Acrobat Dependency Exists
- What the Main CLI Tools Actually Do
- Real-World Examples: Replacing Common Acrobat Tasks
- Where CLI Tools Fall Short
- How to Choose: A Decision Framework
- Common Problems and How to Solve Them
- Safety and Reliability Considerations
- Cost Comparison: Free vs. Subscription
- Frequently Asked Questions
Yes, for most PDF tasks, command-line tools can replace Adobe Acrobat entirely, but not for every single job. If you need to merge, split, compress, convert, encrypt, or extract text from PDFs, free CLI tools like qpdf, pdftk, Ghostscript, and Poppler handle these reliably and often faster than a GUI. However, complex tasks like advanced form design, OCR with layout preservation, or fixing broken PDF internals may still require Acrobat or a specialized GUI tool.
Background: Why the Acrobat Dependency Exists
Adobe Acrobat has been the de facto standard for PDF manipulation since the 1990s. Its GUI makes tasks like rearranging pages, adding watermarks, and filling forms feel simple. But Acrobat is expensive, heavy, and often overkill for scripted or batch operations. CLI tools emerged from the open-source community to fill the gap, offering precise control and automation. The PDF format itself is open (ISO 32000), which means any software can read and write it, and many CLI tools are built directly on the same libraries that power popular GUI apps.
What the Main CLI Tools Actually Do
Each tool has a specialty, and knowing which to use saves time:
- qpdf — The best for structural operations: merge, split, rotate, encrypt, decrypt, and linearize PDFs. It preserves metadata and object structure better than most.
- pdftk — A Swiss-army knife for page manipulation: merge, burst, fill forms, apply watermarks, and update metadata. It's older but still widely used.
- Ghostscript — A PostScript/PDF interpreter that excels at converting PDFs to images, compressing, and converting PostScript to PDF. It's the engine behind many other tools.
- Poppler — A suite of utilities:
pdftotext(extract text),pdftoppm(render pages to images),pdfimages(extract images), andpdfinfo(get metadata).
These tools are available on Linux, macOS (via Homebrew), and Windows (via package managers like Chocolatey or Scoop).
Real-World Examples: Replacing Common Acrobat Tasks
Here are concrete commands that cover the most frequent Acrobat actions:
- Merge two PDFs:
qpdf --empty --pages a.pdf b.pdf -- merged.pdf - Split every page into a separate file:
pdftk input.pdf burst(creates pg_0001.pdf, pg_0002.pdf, etc.) - Extract text from page 3:
pdftotext -f 3 -l 3 input.pdf - - Compress a PDF:
ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -o output.pdf input.pdf - Encrypt with a password:
qpdf --encrypt userpass ownerpass 256 -- input.pdf output.pdf - Rotate all pages 90 degrees:
qpdf --rotate=+90 input.pdf output.pdf
These commands are scriptable, so you can process hundreds of files in a loop, something Acrobat's GUI makes tedious.
Where CLI Tools Fall Short
There are genuine gaps. Acrobat's strengths that CLI tools can't fully replicate:
- OCR (Optical Character Recognition): While
tesseractcan OCR images, integrating it with a PDF's text layer while preserving original layout and fonts is messy. Acrobat's built-in OCR is more polished. - Form creation and complex form fields: You can fill forms with pdftk, but designing interactive forms with validation, calculations, and JavaScript is not feasible from the command line.
- Repairing corrupted PDFs: qpdf can attempt recovery, but Acrobat's repair engine handles more edge cases.
- Accessibility tagging: Adding proper tags for screen readers is a manual, visual process in Acrobat.
How to Choose: A Decision Framework
Ask yourself these questions before picking a tool:
- Is this a one-time task or a recurring batch? If recurring, CLI wins because you can automate it.
- Do you need to preserve interactive elements? If yes, test the CLI output carefully; some tools flatten or drop form fields.
- Is the PDF generated by a standard tool? If it's from Word, Google Docs, or a scanner, CLI tools handle it fine. If it's from a proprietary system, expect quirks.
- Do you need OCR? If yes, consider a dedicated OCR tool like OCRmyPDF (which wraps tesseract) rather than Acrobat.
- Are you comfortable reading man pages? CLI tools have a learning curve, but the syntax is consistent once you learn a few patterns.
Common Problems and How to Solve Them
Even with the right tool, you'll hit issues. Here are the frequent ones:
- Fonts not embedding: When converting with Ghostscript, use
-dEmbedAllFonts=trueto avoid missing glyphs on other machines. - File size doesn't shrink: Compression only works if the original has redundant data. Try
-dPDFSETTINGS=/screenfor maximum compression, but expect quality loss. - Text extraction returns gibberish: The PDF may contain only images (scanned). Run OCR first, or use
pdftoppmto see what's actually on the page. - Merged PDF has broken links or bookmarks: Use qpdf's
--preserve-unreferenced-resourcesflag to keep metadata intact. - Command not found on Windows: Install via Chocolatey:
choco install qpdf poppler(requires admin).
Safety and Reliability Considerations
Always keep a backup of your original PDFs. Some CLI operations (like pdftk burst) overwrite files in the current directory. Test on a copy first. Also, be aware that encryption with qpdf uses standard algorithms (AES-256), but if you forget the password, there is no recovery — the same as Acrobat. For sensitive documents, ensure you're using a trusted tool from your system's package manager, not a random binary from a forum.
Cost Comparison: Free vs. Subscription
Acrobat Pro costs around $20/month, and the Standard version is a one-time purchase. The CLI tools are free and open-source (qpdf, Ghostscript, Poppler are all under open licenses). For a business processing thousands of PDFs, the cost savings are obvious, but the real win is time: a script that merges 100 PDFs takes seconds, while clicking through Acrobat takes minutes. The trade-off is the learning curve and lack of visual feedback.
Frequently Asked Questions
Can I edit text in a PDF using CLI tools?
Not directly. CLI tools can extract text and images, but editing the text itself (like changing a word) requires either a tool like pdftk to manipulate form fields, or a GUI editor. For simple edits, you'd extract to a text format, edit, and regenerate — but that loses formatting. Acrobat's text editor is still the easiest for that.
Is there a CLI tool that can fill PDF forms?
Yes, pdftk can fill flat forms using an FDF file. You create a data file with field values and run pdftk form.pdf fill_form data.fdf output filled.pdf. For XFA forms (dynamic forms), it's more complex — qpdf can't handle those, and you may need a tool like jpdf or a browser extension.
How do I convert a PDF to Word or Excel from the command line?
There's no reliable CLI that preserves formatting perfectly. Tools like pandoc can convert PDF to Markdown or plain text, but for Word, you'd need a library like pdf2docx (Python) which works okay for simple layouts. For complex documents, Acrobat's export is still superior.
Are these CLI tools safe to use on Windows?
Yes, if you install them via official package managers like Chocolatey or Scoop, they're vetted. Avoid downloading executables from random websites. Also, run them in a sandbox or virtual machine if you're processing untrusted PDFs, as PDFs can contain malicious JavaScript — though CLI tools typically ignore that.
Can I automate PDF creation from HTML or Markdown?
Yes, wkhtmltopdf (which uses WebKit) and pandoc with a LaTeX engine are excellent. They produce clean, searchable PDFs from HTML or Markdown, and you can style them with CSS. This is a common alternative to Acrobat for generating reports.