Monday, October 13, 2014

Fix for PrimoPDF opening PDF files with spaces in filename

Today I was using PrimoPDF to print and got an error from Adobe Reader XI:

"There was an error opening this document.  This file cannot be found."

after the PDF file was created and it was attempting to be opened.  (I use the PrimoPDF setting for "Post Process" to "Open PDF".)  At first I thought there was a problem with Adobe Reader XI as this was newly installed, and I had never noticed this problem before with Adobe Reader X.  The PDF file was printed, and did exist, so something else was going wrong.  I was able to open the PDF file manually from Adobe.  Upon further investigation  it appears that PrimoPDF is not passing the path to the PDF file in double quotes to Adobe, so any files with spaces in their names will not open.  The fix is to either not have spaces in your filenames, or I wrote a small batch file to correct this issue.  The batch file is simply:

REM Helper batch file to launch Adobe from PrimoPDF
"C:\Program Files (x86)\Adobe\Reader 11.0\Reader\AcroRd32.exe" "%*"

Just save those 2 lines to a text file, and save it as something like "p2a11.bat".  In your PrimoPDF settings, change it to call this batch file, instead of the Adobe Reader directly.  For example:

Now I am able to print to PDF files with spaces in their names, and have PrimoPDF automatically open them up for me afterwards.

No comments:

Post a Comment