I am working in Windows platform.
It is possible to open a PDF file at a specific page:
AcroRd32.exe /A "page=3" "file.pdf"
Is there a similar solution for printing a specific page? Something like:
AcroRd32.exe /P "page=3" "file.pdf"
I am working in Windows platform.
It is possible to open a PDF file at a specific page:
AcroRd32.exe /A "page=3" "file.pdf"
Is there a similar solution for printing a specific page? Something like:
AcroRd32.exe /P "page=3" "file.pdf"
Something like:
AcroRd32.exe /P "page=3" "file.pdf"
No. There is no option to print a specific page.
What you could do is use the /p
option together with a VBS (or similar) script to manipulate the Print dialog and select the required page to print:
AcroRd32.exe /p pathname
— Executes Adobe Reader and displays the Print dialog box.
See below for a list of the possible command line options.
These are unsupported command lines, but have worked for some developers.
There is no documentation for these commands other than what is listed below. You can display and print a PDF file with Acrobat and Adobe Reader from the command line.
NOTE: All examples below use Adobe Reader, but apply to Acrobat as well.
If you are using Acrobat, substitute Acrobat.exe in place of AcroRd32.exe on the command line.
AcroRd32.exe pathname
— Executes Adobe Reader and displays the file, whose full path must be provided.Other options for the command line are:
/n
Launches a separate instance of Acrobat or Adobe Reader, even if one is currently open.
/s
Opens Acrobat or Adobe Reader, suppressing the splash screen.
/o
Opens Acrobat or Adobe Reader, suppressing the open file dialog.
/h
Opens Acrobat or Adobe Reader in a minimized window.
AcroRd32.exe /p pathname
— Executes Adobe Reader and displays the Print dialog box.
AcroRd32.exe /t path "printername" "drivername" "portname"
— Initiates Adobe Reader and prints a file, whosepath
must be fully specified, while suppressing the Print dialog box.The four parameters of the
/t
option evaluate topath
,printername
,drivername
, andportname
(all strings).
printername
— The name of your printer.
drivername
— Your printer driver’s name, as it appears in your printer’s properties.
portname
— The printer’s port.portname
cannot contain any/
characters; if it does, output is routed to the default port for that printer.
Source Acrobat Developer FAQ
Here is how I do it:
pdf_print_sendkeys.vbs:
Dim ObjArgs
Set ObjArgs = wscript.arguments
cmd = objargs(0) & " /P " & objargs(1)
Set objShell = WScript.CreateObject ("WScript.shell")
objshell.exec(cmd)
WScript.Sleep 5000
objShell.AppActivate "Print"
objShell.SendKeys "%g", TRUE ' Alt + g [Pages]
objShell.SendKeys "{TAB}", TRUE ' Input Pages
objShell.SendKeys objargs(2), TRUE ' Start and End Page
objShell.SendKeys "{ENTER}", TRUE ' Print!
Set objShell = Nothing
Test:
wscript "C:\tmp\pdf_print_sendkeys.vbs" "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" "C:\tmp\test.pdf" "2-3"
See here for my full write-up and further utilization etc.
For PDF printing the #1 "Windows App" has to be Adobe Acrobat and an answer already given to use native VBS.
I support SumatraPDF which is often used as a ONE.EXE app, for lighter-weight PDF handling with single page print abilities.
HOWEVER I will always suggest there are 2 far better methods.
Acrobat
2. Ghostscript.
So GhostScript has several advantages over Acrobat.
At its simplest the command is:
gs -sDEVICE=mswinpr2 -o "%printer%Printer Name" "path to input.pdf"
Windows users will use for gs either gswin32c.exe or gswin64c.exe and there are other options for after testing such as
-q -dNoCancel
To select one page, as per OP desire, simply use -sPageList=3
ImageMagick can extract specific page(s) of PDF documents as images, so if you want to print page 3, you could use the following command (bearing in mind that it counts from page ZERO):
magick file.pdf[2] page.bmp
mspaint /pt page.bmp
Or, if you have a "penchant" for one-liners:
magick file.pdf[2] page.bmp && mspaint /pt page.bmp
If the resolution is too low/blocky, use:
magick -density 144 file.pdf[2] page.bmp
If you don't like MS-Paint, or prefer PNG
files for some reason:
magick file.pdf[2] page.png
rundll32 C:\WINDOWS\system32\shimgvw.dll,ImageView_PrintTo "page.png" "Fictional HP Printer"
© 2022 - 2025 — McMap. All rights reserved.