Automate on the command line: page size, pages per sheet and printing certain pages

If you do PDF work in scripts or batch files, version 11.34.0 lets you do more without clicking.

Change the page size and pages per sheet: The DocTool has the new commands -changePageSize (with -pageSize, for example A4, letter or 210x297mm, and -orientation) and -nup (with -pagesPerSheet, -paperSize, -borders and more). They give the same result as the Toolbox tools and work with -silent, -outputDir and -outputFile. Two examples from the manual:

"C:\Program Files\PDF24\pdf24-DocTool.exe" -changePageSize -pageSize A4 -silent -outputDir "C:\Out" "C:\In\*.pdf"
"C:\Program Files\PDF24\pdf24-DocTool.exe" -nup -pagesPerSheet 4 -paperSize A3 -borders -silent -outputFile "C:\Out\handout.pdf" "C:\In\slides.pdf"

Print certain pages: PDF24 Reader prints only certain pages with /print or /printTo together with /pages, for example /pages 1-2, /pages 3- (to the end) or /pages 1,4,6-8. This way the first two pages can go to a printer with letterhead and the rest to another one:

"C:\Program Files\PDF24\pdf24-Reader.exe" /printTo "Printer with letterhead" /pages 1-2 "C:\Docs\letter.pdf"
"C:\Program Files\PDF24\pdf24-Reader.exe" /printTo "Office Printer" /pages 3- "C:\Docs\letter.pdf"

More news in the DocTool:

  • pdf24-DocTool.exe -help (also /? or without arguments) shows a short overview of the commands, options and exit codes.
  • -outputDir and -outputFile understand date, time and environment variables, for example -outputDir "D:\Archive\%Y-%m" for one folder per month. Missing folders are created.
  • -extractAttachments -nameAfterPdf names the attachments like the PDF: invoice1.pdf becomes invoice1.xml, handy for the XML data of many e-invoices.
  • -password also applies without -silent: the DocTool tries the password first and only asks if it does not fit.

All commands and options are in the manual: change the page size, pages per sheet and PDF24 Reader.