Everything PlanetPDF does in its window can also be done without it: from a command prompt or script, by another program, or by a plugin that adds its own items to PlanetPDF's menus. This chapter explains what each is for and how to use it. It works the same on Windows, the Mac, and Linux.
planetpdf and a command in a command prompt, PowerShell, or a script.Signing always asks you. Scripts, programs, and plugins may use every function, but whenever one wants to digitally sign a document with your Digital ID, PlanetPDF shows a window asking you first. A script can't answer it for you.
planetpdf works in any new command prompt or PowerShell window. Without it, use the full path: & "C:\Program Files\PlanetPDF\PlanetPDF.com" help./Applications/PlanetPDF.app/Contents/MacOS/PlanetPDF help in Terminal.Running planetpdf with a file name instead of a command simply opens the file in the PlanetPDF window, as before.
| Type | To see |
|---|---|
planetpdf help | Every command, by group, with a line on what it does. |
planetpdf help export | One command's options (here export). |
planetpdf commands --json | Every command and option, for programs. |
planetpdf --version | The version of PlanetPDF. |
planetpdf info report.pdf
Shows the pages, size, details, protection, signatures, and form fields.
planetpdf export report.pdf --format docx --out report.docx
Saves a Word copy.
planetpdf compress scan.pdf --quality small --out scan_small.pdf
Makes a smaller copy.
planetpdf redact report.pdf --preset ssn --find "John Q. Public" --overlay-text REDACTED --out report_redacted.pdf
Removes every Social Security number and the name for good, then checks the result.
planetpdf fill form.pdf --set "Name=Jane Doe" --set Agree=on --flatten --out filled.pdf
Fills in a form and makes the answers part of the page.
planetpdf sign contract.pdf --id <ID from signing-ids> --out contract_signed.pdf
Signs with a Digital ID from your certificate store; PlanetPDF asks you first.
In PowerShell, to compress every PDF in a folder:
Get-ChildItem *.pdf | ForEach-Object { planetpdf compress $_.FullName --out ($_.BaseName + "_small.pdf") }
--overwrite, including every file it makes: each part of split, and each page's picture of export --format png (or jpg, tiff). It writes over its own input file only when --out names that file. In the window, Split Document and an export to a picture per page ask before replacing files already there.--pages "1-3, 7, 10-" (10 to the end).--json (for scripts). Progress ("Reading page 3 of 10") is shown separately (on stderr), so it never mixes with the result; --quiet hides it.%ERRORLEVEL% in a batch file, $LASTEXITCODE in PowerShell):| Code | Meaning |
|---|---|
| 0 | Done. |
| 1 | It failed; the message says why. |
| 2 | The command was used wrongly (unknown command, missing or bad option). |
| 3 | Signing wasn't approved. |
| 4 | Done, but a check failed (redaction verification, compliance check, or a signature that is invalid or was changed after signing). |
| 130 | Stopped with Ctrl+C. |
For a protected file, or a Digital ID file's password:
--password - asks you to type it (it isn't shown as you type).--password env:NAME reads it from the environment variable NAME.Caution: a password typed straight on the command line (--password secret) can be seen by other programs on the computer. Use one of the two ways above.
planetpdf signing-ids lists the Digital IDs in Windows' certificate store (or the Mac Keychain) that can sign. Pass one with --id, or a Digital ID file with --pfx. Every time, PlanetPDF shows Allow Digital Signing? describing what will be signed; click Allow or Don't Allow. If it isn't allowed, the command ends with exit code 3.
Type planetpdf help and the command's name for its options.
| Group | Command | What it does |
|---|---|---|
| Read | info | Details of a PDF: pages, size, metadata, protection, signatures, form fields |
| Read | text | The text of a PDF's pages, in reading order |
| Read | search | Find words, phrases, or patterns (SSNs, phone numbers…) in a PDF |
| Read | bookmarks | A PDF's bookmarks |
| Read | compare | Compare the text of two PDFs |
| Read | set-metadata | Change a PDF's title, author, subject, or keywords |
| Forms | fields | A form's fields: names, kinds, values, and choices |
| Forms | fill | Fill in a form's fields |
| Forms | flatten-forms | Make a form's fields part of the page |
| Sign | signatures | Check a PDF's digital signatures |
| Sign | signing-ids | The Digital IDs in Windows' certificate store or the Mac Keychain that can sign |
| Sign | sign | Digitally sign a PDF (always asks you first) |
| Standards | check-compliance | Check a PDF against PDF/A, PDF/X, or PDF/E |
| Standards | save-as-standard | Save as PDF/A, PDF/X, or PDF/E (through Ghostscript) |
| Optimize | space-usage | What takes the room in a PDF (pictures, fonts, content…) |
| Optimize | compress | Make a PDF smaller (pictures resampled, scans in black and white or gray, fonts cut down) |
| Export | export | Save a PDF's pages as Word, Excel, PowerPoint, pictures, text, HTML… (add --ai to read the pages with AI text reading, where it can run) |
| Scan | ocr | Recognize text on scanned pages, so they can be searched and copied |
| Scan | optimize-scans | Straighten, clean, and shrink scanned pages |
| Scan | remove-blank-pages | Remove blank pages (scans' empty backs) |
| Create | combine | Combine PDFs and pictures into one PDF, in the order given |
| Create | create | Make a PDF from each file (pictures, text, Office files, XPS, EPUB…) |
| Create | web-page | Make a PDF of a web page (through Microsoft Edge or Chrome) |
| Pages | split | Split a PDF into several files |
| Pages | extract | Make a new PDF of some pages |
| Pages | delete-pages | Delete pages |
| Pages | rotate | Turn pages |
| Pages | reorder | Put the pages in a new order |
| Pages | insert | Insert another PDF's pages |
| Pages | crop | Crop pages (margins in points: 72 = 1 inch) |
| Pages | header-footer | Add headers and footers ({page}, {pages}, {date}, {file}) |
| Pages | bates | Add Bates numbers |
| Pages | watermark | Add a text or picture watermark |
| Pages | remove-marks | Remove headers and footers, Bates numbers, watermarks, or backgrounds PlanetPDF added |
| Redact | redact | Remove text for good (words, phrases, patterns), then check the result |
| Redact | sanitize | Remove hidden information: metadata, comments, attachments, scripts, hidden layers… |
| Protect | protect | Password-protect a PDF (AES-256) |
| Protect | unprotect | Remove a PDF's password protection |
Two more commands are for programs: planetpdf commands lists the commands, and planetpdf serve runs the local API without a PlanetPDF window until you press Ctrl+C. For IT, planetpdf policy shows the settings an administrator made for everyone on the computer (see Checking that your policy is in force).
Other programs on your computer can ask PlanetPDF to do work through its local API: JSON-RPC 2.0, one JSON message per line, over a named pipe (Windows) or a socket file (Mac, Linux). Only programs running as you on this computer can connect; it is never open to the network. Every command of the command line is an API method of the same name, with the same options, and long jobs send progress as they go.
api.json in its local app data folder (Windows: %LOCALAPPDATA%\Planet Networks\PlanetPDF). Without a PlanetPDF window, planetpdf serve provides the API.api.json, which only you can read, also holds a key. A program first has PlanetPDF prove that it holds that key, so on a computer several people use, nobody else's program can pass for your PlanetPDF and receive what was meant for it. The Python client does this by itself, and sends nothing at all, not even its token, when it has no key to check with.Programmers will find a ready-made Python client (planetpdf_client.py, standard library only) and an example plugin in the sdk folder of PlanetPDF's resources, and the full description (methods, messages, error codes) in the developer guide, docs/SCRIPTING.md.
The API is off until you turn it on: tick Let other programs and plugins use PlanetPDF in Preferences ▸ Scripting & Plugins (it takes effect the next time PlanetPDF starts; turning a plugin on starts it at once). The list of programs you allowed is sealed with a key Windows (or the Mac's Keychain) keeps for you, so a program can't add itself by editing the file: a list changed outside PlanetPDF is ignored, and each program is asked about again.
A plugin is a small program that adds commands to PlanetPDF's menus. When you choose one of its items, PlanetPDF starts the plugin as a separate program, which then uses PlanetPDF through the local API, for example to stamp and file the open invoice.
%APPDATA%\Planet Networks\PlanetPDF\plugins.PLANETPDF_PLUGINS.)Nothing a plugin contains runs until you turn it on.
To turn it off, untick it.
Changed plugins turn off. PlanetPDF remembers exactly what the plugin's files were when you turned it on. If any of them change (an update, or tampering), it is off again until you turn it on again, so you see what it asks for each time it changes.
What a plugin prints goes to logs\plugins in the profile folder, and what it did through PlanetPDF is in the Activity Log….
Important: a plugin is a program running as you, like any program you start. Its permissions limit what it can do through PlanetPDF (asking for anything else is refused), not what it could do on its own. Turn on only plugins from people you trust.