phppdf Docs

A PHP library for programmatic PDF generation and manipulation

Source ↗

Documentation

CLI

The phppdf binary is installed to vendor/bin/phppdf by Composer.

vendor/bin/phppdf <command> [options] [arguments]

phppdf text

Extract plain text from a PDF file and print it to stdout.

vendor/bin/phppdf text document.pdf

Options

OptionDescription
--page=NExtract only page N (0-based)

Example

vendor/bin/phppdf text report.pdf --page=0

phppdf info

Print the PDF version, page count, and /Info dictionary entries.

vendor/bin/phppdf info document.pdf

Example output

Version    : 1.7
Pages      : 12
Title      : Annual Report 2025
Author     : Jane Smith
Subject    : Financial results
Creator    : My App 1.0

phppdf merge

Combine two or more PDF files into a single output file.

vendor/bin/phppdf merge -o merged.pdf file1.pdf file2.pdf file3.pdf

Options

OptionDescription
-o <path>Output file path (required)

Example

vendor/bin/phppdf merge -o combined.pdf cover.pdf body.pdf appendix.pdf

Pages from each file are appended in the order the files are given. Encryption, bookmarks, and digital signatures from source files are not carried over (see Merging for the same limitation in the PHP API).