• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

PowerBuilder application programmatically creating and saving pdf in DB

New Here ,
May 09, 2019 May 09, 2019

Copy link to clipboard

Copied

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

TOPICS
Acrobat SDK and JavaScript

Views

967

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 10, 2019 May 10, 2019

Copy link to clipboard

Copied

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.

2019-05-10_15-47-10.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 13, 2019 May 13, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 13, 2019 May 13, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 14, 2019 May 14, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 14, 2019 May 14, 2019

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines