Available in pre-release 3.7
You can run to perform operations on PDF and other files. Both work with the portable EXE; no install required.
sumatrapdf-tool.exe <tool> or SumatraPDF.exe sumatrapdf-tool.exe vs. SumatraPDF.exe #
When you install SumatraPDF, we also install
sumatrapdf-tool.exe and add it to PATH.sumatrapdf-tool.exe is a console program that provides command-line access to many of SumatraPDF’s features.It’s meant for use from the command line or from scripts.
The same commands work with the portable EXE as
SumatraPDF.exe <tool> — no install and no extra extract. You can also extract sumatrapdf-tool.exe with -x if you want the console binary.The difference is that
SumatraPDF.exe is a GUI application, so it won’t work as well when, for example, redirecting output to a file or running from scripts.I want to… #
| Goal | Tool / doc |
|---|---|
| Delete specific pages | clean — Delete pages from PDF |
| Delete the last page without knowing the count | clean input.pdf out.pdf 1--2 (-2 = second-to-last page) |
| Extract pages into a new PDF | clean — Extract pages from PDF |
| Merge PDFs | merge — Merge PDFs |
| Split a PDF | merge / clean — Split a PDF |
| Reorder pages | clean — Reorder pages in a PDF |
| Rotate pages permanently | run — Rotate PDF pages |
| Crop page margins | run — Crop PDF page margins |
| Print a large page as a poster | run — Print a large page as a poster |
| Add page numbers / a watermark | run — Page numbers, Watermark |
| Add bookmarks (table of contents) | run — Add a table of contents |
| Search text in one or many PDFs | grep — Tool grep |
| Extract plain text | draw -tt or grep — Extract text from PDF |
| Extract embedded images | extract — Extract images from PDF |
| Extract fonts | info, extract — Extract fonts from a PDF |
| Save attached files | extract, run — Save files attached to a PDF |
| Compress / rewrite PDF | clean — Compress a PDF |
| Remove compression streams | clean — Decompress a PDF |
| Password-protect a PDF | clean — Encrypt a PDF |
| Remove password | clean — Decrypt a PDF |
| Repair a damaged PDF | clean — Repair a damaged PDF |
| Convert to grayscale | recolor — Convert a PDF to grayscale |
| Flatten forms and annotations | bake — Flatten PDF forms and annotations |
| Sign a PDF | sign — Sign a PDF, Tool sign |
| Convert images / other formats to PDF | convert / draw — Tool convert; how-tos: images, comics, EPUB |
| Inspect PDF structure | info, show, pages — See PDF info, Tool info |
| Run a tool on many files | Process many PDFs at once |
| Run JavaScript on PDFs | run — Tool run |
The same page-delete operations are also available in the app:
Ctrl + K, Delete Pages From PDF command in Command Palette, or context menu Document → Delete Pages From PDF.sumatrapdf-tool.exe <command> [options]
draw -- convert document
convert -- convert document (with simpler options)
audit -- produce usage stats from PDF files
bake -- bake PDF form into static content
clean -- rewrite PDF file
create -- create PDF document
extract -- extract font and image resources
info -- show information about PDF resources
merge -- merge pages from multiple PDF sources into a new PDF
pages -- show information about PDF pages
poster -- split large PDF page into many tiles
recolor -- change colorspace of PDF document
show -- show internal PDF objects
sign -- manipulate PDF digital signatures
trim -- trim PDF page contents
grep -- search for text
trace -- trace device calls
run -- run a MuPDF JavaScript program
Tools: