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
367 views
in Technique[技术] by (71.8m points)

Printing PDFs from Windows Command Line

I'm trying to print all pdfs in current dir. When I call this bash script in cmd (singlepdf.sh): '"C:Program Files (x86)AdobeReader 10.0ReaderAcroRd32.exe"' /t Gemeinde_348_BioID_842_alt.pdf everything's working fine.

When calling multiplepdfs.sh with this content:

declare -a pdfs=(*.pdf)

for pdf in ${pdfs[@]}; do
  echo -e "
printing **$pdf** with AcroRd32.exe...
"
  '"C:Program Files (x86)AdobeReader 10.0ReaderAcroRd32.exe"' /t $pdf
  sleep 3
done

The echo shows that files are addressed correctly in the loop - but then I get the error "C:Program Files (x86)AdobeReader 10.0ReaderAcroRd32.exe": No such file or directory

Can someone help out with this issue?

Edit: BTW, I have msys mingw installed

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

I know this is and old question, but i was faced with the same problem recently and none of the answers worked for me:

  • Couldn't find an old Foxit Reader version
  • As @pilkch said 2Printer adds a report page
  • Adobe Reader opens a gui

After searching a little more i found this: http://www.columbia.edu/~em36/pdftoprinter.html.

It's a simple exe that you call with the filename and it prints to the default printer (or one that you specify). From the site:

PDFtoPrinter is a program for printing PDF files from the Windows command line. The program is designed generally for the Windows command line and also for use with the vDos DOS emulator.

To print a PDF file to the default Windows printer, use this command:

PDFtoPrinter.exe filename.pdf

To print to a specific printer, add the name of the printer in quotation marks:

PDFtoPrinter.exe filename.pdf "Name of Printer"

If you want to print to a network printer, use the name that appears in Windows print dialogs, like this (and be careful to note the two backslashes at the start of the name and the single backslash after the servername):

PDFtoPrinter.exe filename.pdf "\SERVERPrinterName"

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

...