CLI
Every pidief operation is a CLI subcommand. The same operations, with the same parameters, are available over the HTTP API.
Examples
Create PDFs
# HTML with its assets (images, CSS) to PDF, with page numbers
pidief html report.html img/logo.png css/report.css --page-numbers --title "Monthly report" -o report.pdf
# A4, 20 mm margins, PDF/A, custom footer with "page / total"
pidief html contract.html --paper A4 --margin 20mm --pdfa \
--footer '<div style="font-size:8px;width:100%;text-align:center"><span class="pageNumber"></span> / <span class="totalPages"></span></div>'
# Template + JSON data to PDF, and an HTML preview of the same template
pidief template invoice.html data.json --strict --empty "-" -o invoice.pdf
pidief template preview invoice.html data.json -o preview.html
# Phone scans to PDF
pidief images scan1.jpg scan2.jpg --max-dpi 150 --grayscale -o scans.pdf
Edit PDFs
pidief merge a.pdf b.pdf -o merged.pdf
pidief split report.pdf --span 5 -o parts/ # or --at 3,7, or --ranges 1-2 --ranges 5-
pidief pages select report.pdf --pages "3,1-2"
pidief pages delete report.pdf --pages "l"
pidief pages rotate scan.pdf --degrees 90 --pages even
pidief watermark contract.pdf --text "DRAFT"
pidief stamp contract.pdf --text "Page %p of %P · APPROVED" --position br --font-size 10 --color "#C00000"
pidief stamp contract.pdf signature.png --position br --scale 0.2
pidief compress scan.pdf --image-quality 60 --max-image-pixels 1600
pidief pdfa report.pdf --title "Statement"
pidief encrypt report.pdf --user-password 1234 --allow-print
pidief decrypt report.pdf --password 1234
pidief metadata report.pdf --title "Receipt" --property DocumentNo=R-2026-08
Read PDFs
pidief info report.pdf
pidief text report.pdf
pidief render report.pdf --pages 1 --format webp --max-width 300 -o thumb.webp
Server and API schema
pidief openapi > openapi.json
pidief serve
Page selection
Page selection follows the pdfcpu syntax, for example 1-3,5,!2, even, odd, l (last page) and l-1.
Input and output
-o -writes to stdout, and a-input reads from stdin.- Results with several files (split, multi-page render) go to a directory, or to a ZIP with
-o out.zip. pidief <command> --helplists every flag of a command.
Exit codes
| Code | Meaning |
|---|---|
| 0 | success |
| 2 | invalid input |
| 1 | other errors |
Template syntax and helpers are described in Template language.