Skip to main content
michaels73867296
Participant
May 9, 2019
Question

PowerBuilder application programmatically creating and saving pdf in DB

  • May 9, 2019
  • 1 reply
  • 2903 views

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

This topic has been closed for replies.

1 reply

Joel Geraci
Community Expert
Community Expert
May 10, 2019

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.

michaels73867296
Participant
May 13, 2019

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.

Legend
May 13, 2019

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.