How to close Acrobat reader from the command line?
Posted: Mon Jan 10, 2011 6:55 pm
Hi,
Thanks for the great tool it seems to be doing everything that I need except for the final step.
I'm using this tool from the command line to automate the reprinting PDFs. Some of the PDFs that I receive are very bloated so I'm reprinting/recreating them, this often reduces their size but over 90%, but unfortunately the tool isn't closing the original PDF after printing.
I'm working with the example given here http://www.biopdf.com/guide/examples/command_line/
@ECHO OFF
@REM Set environment variables used by the batch file
SET PRINTERNAME=Bullzip PDF Printer
REM Create runonce.ini
SET LAPP=%LOCALAPPDATA%
IF "%LAPP%"=="" SET LAPP=%USERPROFILE%\Local Settings\Application Data
SET RUNONCE=%LAPP%\PDF WRITER\%PRINTERNAME%\runonce.ini
ECHO %RUNONCE%
IF EXIST "%RUNONCE%" DEL "%RUNONCE%"
ECHO Save settings to "%RUNONCE%"
ECHO [PDF Printer] >> "%RUNONCE%"
ECHO output=%CD%\out\demo.pdf >> "%RUNONCE%"
ECHO author=Demo Script >> "%RUNONCE%"
ECHO showsettings=never >> "%RUNONCE%"
ECHO showpdf=no >> "%RUNONCE%"
ECHO watermarktext=Batch Demo >> "%RUNONCE%"
ECHO confirmoverwrite=no >> "%RUNONCE%"
printto.exe "in\example.pdf" "%PRINTERNAME%"
ECHO ERRORLEVEL=%ERRORLEVEL%
EDIT: Everything works perfectly when run against the example.rtf
Execution is frozen on the printto.exe line until I manually close acrobat.
I've also noticed that the new PDF is opened once I manually close the original PDF. This seems to be over and above the "showpdf=no" param if I set this to yes I get two copies of the new PDF opened
If you'd like to see my code so far please let me know. Any help will be greatly appreciated
Thanks for the great tool it seems to be doing everything that I need except for the final step.
I'm using this tool from the command line to automate the reprinting PDFs. Some of the PDFs that I receive are very bloated so I'm reprinting/recreating them, this often reduces their size but over 90%, but unfortunately the tool isn't closing the original PDF after printing.
I'm working with the example given here http://www.biopdf.com/guide/examples/command_line/
@ECHO OFF
@REM Set environment variables used by the batch file
SET PRINTERNAME=Bullzip PDF Printer
REM Create runonce.ini
SET LAPP=%LOCALAPPDATA%
IF "%LAPP%"=="" SET LAPP=%USERPROFILE%\Local Settings\Application Data
SET RUNONCE=%LAPP%\PDF WRITER\%PRINTERNAME%\runonce.ini
ECHO %RUNONCE%
IF EXIST "%RUNONCE%" DEL "%RUNONCE%"
ECHO Save settings to "%RUNONCE%"
ECHO [PDF Printer] >> "%RUNONCE%"
ECHO output=%CD%\out\demo.pdf >> "%RUNONCE%"
ECHO author=Demo Script >> "%RUNONCE%"
ECHO showsettings=never >> "%RUNONCE%"
ECHO showpdf=no >> "%RUNONCE%"
ECHO watermarktext=Batch Demo >> "%RUNONCE%"
ECHO confirmoverwrite=no >> "%RUNONCE%"
printto.exe "in\example.pdf" "%PRINTERNAME%"
ECHO ERRORLEVEL=%ERRORLEVEL%
EDIT: Everything works perfectly when run against the example.rtf
Execution is frozen on the printto.exe line until I manually close acrobat.
I've also noticed that the new PDF is opened once I manually close the original PDF. This seems to be over and above the "showpdf=no" param if I set this to yes I get two copies of the new PDF opened
If you'd like to see my code so far please let me know. Any help will be greatly appreciated