Programmatically print multiple copies from command line

后端 未结 2 498
情话喂你
情话喂你 2021-01-21 14:33

My application generates between 35 and 55 PDF files of which I have to automatically print four copies.

All these files are in a single folder.

My requirement i

相关标签:
2条回答
  • 2021-01-21 15:05

    Adobe Reader is only capable of printing a single copy directly. However, nothing prevents you from looping and printing it 4 times. It may take longer, though, since the document has to be sent to the printer four times.

    From the Acrobat SDK Developer FAQ:

    AcroRd32.exe /t path "printername" "drivername" "portname" — Start Adobe Reader and print a file while suppressing the Print dialog box. The path must be fully specified.

    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.

    So you can probably use something like this:

    for %%F in (*.pdf) do (
      for /L %%i in (1,1,4) do (
        AcroRd32.exe /t "%%~fF" "printername" "drivername" "portname"
      )
    )
    

    Just insert the appropriate values for the missing arguments.

    0 讨论(0)
  • 2021-01-21 15:09

    You can use pdfprint.exe (third party utility) to achieve the purpose. We are using the same to print bunch of pdf files generated at specified location. You can write batch file whcih accepts parameter like printer name,no of copies,pdf file FULL PATH,log file name to read status,and orientation L-landscape or portrait and call batch file from some appliction like .net.

    We have batch file written as below:

    @echo off
    :. %1 - Printer Name
    :. %2 - Number of Copies
    :. %3 - PDF File path to print
    :. %4 - Name of Log file
    :. %5 - Orientation of pdf printing file 1 = Portratit and 2 = Landscape
    :. Add -restoreprinter -checkjobstatus which will maintain the default printer settings.
    
    set PdfPrintPath=some valid path (C:\Folder) where pdfprint.exe is placed
    
    %PdfPrintPath%\pdfprint.exe -restoreprinter -printer %1 -copies %2 -orient %5 %3
    
    set ErrLevel=%errorlevel%
    

    Please let me know for any problem. Have a nice day.

    0 讨论(0)
提交回复
热议问题