← Back to Open-Source PDF Software

Open-Source PDF Software Capable of Compressing PDFs

Reduce PDF file size

19 tools

Command Line

PDFtk Server

Cli

Command-line tool to merge, split, and rotate PDFs; fill forms with FDF/XFDF data and flatten them (or generate an FDF stencil); encrypt/decrypt with passwords; add watermarks/stamps; manage bookmarks, metadata, and attachments; repair damaged PDFs; and recompress page streams.

Command Line

Ghostscript

CliLibrary

PostScript and PDF interpreter/renderer from Artifex: converts PostScript/PDF to images, text, DOCX, PCL, and XPS; compresses PDFs while preserving quality; converts to/validates PDF/A; adds an OCR text layer to scanned pages; imposition (N-up), ICC color management, and ZUGFeRD/Factur-X e-invoicing support.

Command Line

MuPDF

CliGuiLibrary

Lightweight C library, viewer, and CLI toolset for PDF, XPS, and e-book formats: renders and extracts text/images/metadata/structured content; creates, splits, merges, and compresses PDFs; adds annotations (highlights, stamps, shapes); permanently redacts content; digitally signs documents; converts between PDF, SVG, PNG, HTML, and PostScript; and embeds into web pages/apps.

C

libharu

Library

ANSI C library for generating PDFs from scratch: lines, text, and images (PNG/JPEG with CMYK/alpha/CCITT support); Type1/TrueType/CJK font embedding; outlines, text and link annotations; document encryption; Deflate compression; and PDF/A-1b compliant output.

R

qpdf

BindingsLibrary

R bindings for the qpdf C++ library, exposing content-preserving PDF transformations from R: splitting, combining/merging, and compressing PDF files (e.g. `pdf_compress()`). Does not read PDF content itself — the maintainers point to the 'pdftools' R package for text/data extraction.

Go

GoFPDF

Library

Go library for generating PDFs: text with UTF-8/RTL support, standard/TrueType/Type1 fonts, JPEG/PNG/GIF/TIFF images and basic SVG, vector graphics (lines, Bézier curves, arcs, gradients, transparency), barcodes, charts, outline bookmarks, internal/external links, page templates and importing existing PDFs as templates, layers, document protection/encryption, and file attachments/annotations.

DepreciatedStale
Go

UniPDF

Library

Go PDF library (pure Go): generates reports/invoices with styled text and tables; creates and fills forms; merges, splits, reorders, and rotates pages (incl. N-up layouts); extracts text (with position/formatting), images, and tabular data to CSV; adds/converts images to PDF; removes or adds password protection; validates and applies digital signatures; compresses/optimizes files; adds watermarks; and supports CCITTFax/JBIG2 image decoding.

Go

pdfcpu

CliLibrary

Go PDF processor (CLI + library) supporting PDF up to 2.0 (ISO 32000-2): validate, optimize, split, trim, and merge PDFs; encrypt/decrypt; resize, rotate, and crop pages; extract/manipulate images, fonts, and metadata; manage attachments and portfolios; validate, report, and remove digital signatures; add/remove stamps and watermarks; process forms, bookmarks, and annotations; and generate booklets, N-up/N-down layouts, grids, and posters.

Java

Images To PDF

Gui

Android PDF toolkit centered on creating PDFs from camera/gallery images (and converting text files to PDF), plus managing existing PDFs: merge, split, compress, remove/rearrange/rotate pages, extract images, and encrypt/decrypt.

Java

Stirling-PDF

Web ApiWeb App

Self-hostable PDF toolkit with 50+ tools: edit, merge, split, sign, redact, and convert PDFs; OCR scanned pages; compress files; validate signatures; apply watermarks; and automate workflows via no-code pipelines, a REST API, and webhooks. Offered as a browser-based UI, desktop client, or self-hosted server (incl. air-gapped deployment).

Java

OpenPDF

Library

PDF creation/manipulation library: creates PDFs from scratch and modifies existing ones (add/remove pages, edit text); HTML-to-PDF conversion (openpdf-html module); text, fonts, graphics, images, and tables; page layout control; encryption and digital signing (via BouncyCastle); text extraction; PDF-to-image rendering (openpdf-renderer); and PDF 2.0 (ISO 32000-2) features including Brotli stream compression.

Lisp

CL-PDF

Library

Cross-platform Common Lisp library for generating PDF files without third-party tools: TrueType/Type 1 fonts (with Unicode), PNG image embedding, barcode generation, charting, optional zlib compression, and a PDF templating system; pairs with cl-typesetting for a full document-composition system.

Stale
Perl

CAM::PDF

Library

Perl module (PDF 1.0–1.5) for reading and writing PDFs: extract/delete/duplicate pages, get page text/content trees, append/prepend pages from other PDFs, handle password-protected documents and permissions, list/add fonts, list/fill form fields, remove annotations, detect linearized PDFs, remove unused objects, and apply compression filters.

Stale
Perl

PDF::Reuse

Library

Perl module for building PDFs by reusing existing pages as templates/backgrounds: adds positioned/rotated text, embeds JPEG images, hyperlinks, and raw PDF operators; supports built-in and embedded TrueType (UTF-8) fonts, hierarchical bookmarks, attached/embedded JavaScript actions, form field value assignment, and content stream compression.

PHP

mPDF

Library

Generates PDFs from UTF-8 HTML (including CJK content): headers/footers, page numbering, TOC, color handling, embedded fonts, zlib-compressed output, XML-driven charset conversion, basic SVG, and optional barcode generation (via bcmath). Notably lacks state-of-the-art CSS support compared to headless-Chrome-based alternatives.

Python

pdfly

Cli

Pure-Python CLI (companion to pypdf) with commands including 2-up/booklet page layout, cat (extract/merge pages), check-sign (verify signatures), compress/uncompress, extract-annotated-pages, extract-images, extract-links, extract-text, meta/pagemeta, rm (delete pages), rotate, sign, update-offsets (repair simple PDFs), and x2pdf (convert other formats to PDF pages).

Python

OCRmyPDF

CliDriverLibrary

Adds a searchable OCR text layer beneath page images and produces a validated PDF/A file: deskews crooked pages, optionally cleans images pre-OCR, optimizes/compresses images, recognizes 100+ languages via Tesseract, rotates misrotated pages, edits output metadata, parallelizes across CPU cores, and processes multi-thousand-page files in place.

Ruby

HexaPDF

CliLibrary

PDF library and CLI (positioned as a pdftk/Poppler-utils alternative): creates PDFs from scratch with vector drawing, JPEG/PNG/PDF image embedding, and TrueType text with subsetting; a high-level document composition engine (automatic layout, text flow, page breaks, lists, multi-column, reusable styles); modifies and merges existing PDFs; creates AcroForms with Adobe-like appearances; adds annotations, outlines, and file attachments; extracts metadata/text/images/files; encrypts (incl. PDF 2.0 AES-256) and digitally signs; and optimizes file size with object validation.

Ruby

Origami

Cli

Pure-Ruby framework for parsing, modifying, and creating PDF files, with lazy on-demand parsing: compression filters with predictors, RC4/AES encryption (including Revision 6), digital signatures and usage rights, file attachments, AcroForm/XFA forms, and object streams. Ships CLI tools including `pdfcop` for detecting dangerous PDF content (not a full malware-analysis/forensics suite by the author's own description) plus decompression, decryption, encryption, resource-extraction, and metadata-inspection utilities.

Stale