PDF to PDF Command Line Examples

This page contains various examples of using the PDF to PDF API in Command Line. The examples are complete and fully functional. Read more about how to convert PDF to PDF in Command Line.

Basic examples
PDF manipulation examples

Basic examples

Multiple PDFs to PDF file

pdf2pdf -user-name "demo" -api-key "ce544b6ea52a5621fb9d55f8b542d14d" \
    /path/to/cover.pdf \
    /path/to/proposal.pdf \
    /path/to/price.pdf \
    /path/to/contact.pdf > "offer.pdf"

Watermark a PDF file

pdf2pdf -user-name "demo" -api-key "ce544b6ea52a5621fb9d55f8b542d14d" \
    -page-watermark "/path/to/watermark.pdf" \
    /path/to/proposal.pdf > "company_offer.pdf"

Linearize a PDF file

pdf2pdf -user-name "demo" -api-key "ce544b6ea52a5621fb9d55f8b542d14d" \
    -linearize \
    /path/to/not_linearized.pdf > "linearized.pdf"

PDF manipulation examples

Extract page 3 and all pages from 7 to the end from the PDF file

pdf2pdf -user-name "demo" -api-key "ce544b6ea52a5621fb9d55f8b542d14d" \
    -action "extract" \
    -page-range "3,7-" \
    /your-path-to/pdfs/13_pages.pdf > "output.pdf"

Delete the first 3 pages and the 10th page from the PDF file

pdf2pdf -user-name "demo" -api-key "ce544b6ea52a5621fb9d55f8b542d14d" \
    -action "delete" \
    -page-range "1-3,10" \
    /your-path-to/pdfs/13_pages.pdf > "output.pdf"