pdfprint

pdfprint is a free command-line tool for Windows (64-bit) that prints PDF files or counts their pages. It is a single executable with no installer, built on the same PDFium engine used by Chrome. It understands the command lines of Adobe Reader, Foxit Reader and PDF-XChange (/t, /p, /print, /printto), so scripts and programs written for those apps can switch to it without changes, and it can show print dialogs styled after those apps.

It is made by the author of Sumatra PDF.

Download
Coming soon

No release has been published yet.

Copy pdfprint.exe anywhere and run it from a Command Prompt or PowerShell window. Double-clicking it in File Explorer shows a window with this reference and an Open File To Print button.

Usage

pdfprint.exe [options] <file.pdf>...

With no print options it prints the number of pages of the file to stdout. Errors go to stderr. The exit code is 0 on success, 1 on failure (file cannot be opened, printer not found, printing failed) and 2 for incorrect usage.

Options

Options can be written with -, -- or / and are case-insensitive.

-print-to <printer>Print to the named printer.
-print-to-defaultPrint to the default printer.
-print-settings <list>Comma-separated page ranges and print options, see below. Can be repeated.
-print-dialog [style], -p [style]Show a print dialog before printing. style is adobe, foxit, pdfxchange or windows (the default).
-list-printersList installed printers with their paper sizes and trays (bins).
-silentSuppress error messages (only the exit code reports failures). Also skips the update check.
-versionPrint the version number to stdout.
-helpPrint the usage text.
-check-updateCheck if a newer version is available.
-updateDownload the newest version and replace pdfprint.exe in place.
-no-update-checkSkip the automatic once-a-day update check.
-log-file <path>Write the log of this run to the given file instead of %LOCALAPPDATA%\pdfprint\logs.
-show-logsOpen the logs directory in File Explorer.

Adobe Reader, Foxit and PDF-XChange command lines

These forms work the same way as in the original programs, so existing scripts keep working.

/t <file> [printer [driver [port]]]Adobe Reader / Foxit silent print. Without a printer name it prints to the default printer. The driver and port arguments are accepted and ignored.
/p [file]Adobe Reader style: show the print dialog.
/print[:printer=<name>;pages=<ranges>;showui] [file...]PDF-XChange silent print. Without printer= it prints to the default printer. pages= takes the same ranges as -print-settings; showui shows the print dialog.
/printto[:pages=<ranges>;showui] <printer> [file...]PDF-XChange print to a named printer.

Flags such as /n, /o, /exit-when-done and /console, which those programs use to control their windows, are accepted and ignored.

-print-settings takes a comma-separated list of the tokens below (the same syntax as the -print-settings option of Sumatra PDF). Unknown tokens are ignored.

5, 2-6, 10-8Pages or page ranges to print. A reversed range prints backwards. Several ranges can be listed.
last, -1, -3--1Negative numbers count from the end: -1 is the last page, -3--1 the last three.
even, oddPrint only even or odd pages of the selected ranges.
noscale, shrink, fit, stretchPage scaling: print at 100%, shrink oversized pages to fit (the default), scale up or down to fit, or stretch to the paper ignoring the aspect ratio.
centerCenter the page on the paper.
portrait, landscapePaper orientation.
disable-auto-rotationDo not rotate pages to match the paper orientation.
rotate=90, rotate=180, rotate=270Rotate every page by the given angle.
color, monochromeColor or grayscale printing.
collate, nocollateCollate copies or not.
simplex, duplex, duplexlong, duplexshortSingle-sided, or double-sided flipped on the long or short edge (duplex is the long edge).
3xNumber of copies (1 to 9999).
paper=A4, paper=Letter, paper=auto, paper=76mm x 130mmPaper size by name (as shown by -list-printers), custom size in millimeters, or auto to pick the paper closest to each page.
paperkind=<id>Paper size by its Windows DEVMODE id.
bin=<name|id|auto>Paper tray by name or id (see -list-printers), or auto.
output=<file>Print to a file, for printers that support it (for example "Microsoft Print to PDF").
docname=<name>Document name shown in the print queue.
ignore-pdf-print-settingsIgnore the print preferences (duplex, paper, page ranges) stored in the PDF.

Examples

pdfprint.exe report.pdf
pdfprint.exe -print-to-default report.pdf
pdfprint.exe -print-to "HP LaserJet" -print-settings "1-3,duplex,2x" report.pdf
pdfprint.exe -print-to "Microsoft Print to PDF" -print-settings "output=C:\out\report.pdf" report.pdf
pdfprint.exe -print-dialog adobe report.pdf
pdfprint.exe -list-printers
pdfprint.exe /t report.pdf "HP LaserJet"
pdfprint.exe /print:printer="HP LaserJet";pages=1-3 report.pdf
pdfprint.exe /printto "HP LaserJet" a.pdf b.pdf

The first command prints the page count; the others print the file.

Updates, logs and crash reports

Once a day, at startup, pdfprint checks whether a newer version is available and prints a one-line notice on stdout if so. pdfprint -update installs it in place. Use -no-update-check to skip the check (for example when parsing the page count from stdout), or -silent.

Every run writes a log to %LOCALAPPDATA%\pdfprint\logs with the command line, the printer settings used and every error; logs older than 7 days are deleted. When reporting a problem, attach that log. If pdfprint crashes it saves a minidump and uploads it so the crash can be fixed.

Report bugs and ask questions in the Sumatra PDF forum.