We have a PowerBuilder application that generates pdf files by printing to the Adobe PDF printer, named automatically by setting a registry entry, then, once created are read into a PowerBuilder blob variable and saved in an Oracle database. All works fine until we run it on Windows 10. The file is created ok to the file system, named appropriately, but then the PB FileRead fails. It is almost as if Acrobat still has a lock on the file. Any ideas would be greatly appreciated! Thanks
Copy link to clipboard
Acrobat actually might have a lock on the file if the Adobe PDF Print driver is still set to view the PDF results. That's the default when you install Acrobat.
Thanks so much for the help Joel, I are already unchecking that setting manually so that the results are not read.
I tried programmatically controlling that setting by setting the viewprintoutput registry value but no luck.
// set a registry entry to programmatically set adobe pdf viewprintoutput property
li_rc = RegistrySet('HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\Print\Printers\Adobe PDF\PrinterDriverData\', &
'ViewPrintOutput', RegULong!, ai_setting)
What is curious is that my application works in Windows 7 but not in Windows 10.
Is the application running in the foreground, initiated by a click from the logged in user, sat at that computer? Things don't work well when getting to background tasks, and server use is out of the question.
I also suggest trying to copy the created file before giving it to Powerbuilder. That way, if the copy fails, you have control of the process and can check error codes etc; perhaps retry for a few seconds.
Well, that was the easy fix. Since that didn't work, you should seriously reconsider your PDF creation process. Even if you did get something working in Windows 10, the print path is unpredictable and, as you've seen, not consistent across OS / Acrobat versions.... and there can be licensing issues.
Consider using some sort of PDF library tool for programmatic PDF creation.
I actually have it working now in windows 10 but even though it creates the file I named via setting PrinterJobControl registry setting (and also splwow64.exe) it is still prompting for a filename, kind of an extra Save as dialog. In Windows 7 32 and 64 bit I don't get this extra saveas dialog.
Each user will have a license to Acrobat so not sure there are licensing issues. I had this all working with PDFCreator and then was told by management to make it work with Acrobat.