Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
938 views
in Technique[技术] by (71.8m points)

windows - Print a specific PDF page using command line

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"
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Is there a similar solution for printing a specific page?

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.


How Do I Use Command Lines with Acrobat and Adobe Reader on Windows?

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, whose path must be fully specified, while suppressing the Print dialog box.

The four parameters of the /t option evaluate to path, printername, drivername, and portname (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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...