1. Pete Yankovich
  2. PowerBuilder
  3. Monday, 11 October 2021 16:30 PM UTC

We have a PB 2017R2 console app that generates PDF files.  The PDF Saveas failed.  I suspect it may be due to security restrictions recently implemented at our company, but is there any log that is generated or other information that would indicate the issues?  There were no errors in Windows event logs on the server running the app.  The app is executed by a Windows Task on the server.

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 11 October 2021 20:42 PM UTC
  2. PowerBuilder
  3. # 1

Hi Pete;

   Note that all the advice you received requires App / PB upgrades. Before going through all that - that also requires a developer, testing, etc as well. I would first suggest try reinstalling GS. Maybe even with a newer version 9.53 - best  for R2 IMHO). Then make sure that:

  1. Use the INF print driver from GS install
  2. Authorize the print driver to have system access.
  3. Check your Windows "policy" settings

FWIW: I'm still using GS on W2019 and it still works great with various versions of Appeon PB.

HTH

Regards ... Chris

PS ... Quick test before above - run the PB as Admin and see if it works. If so, perform above steps

Comment
  1. Pete Yankovich
  2. Tuesday, 12 October 2021 13:42 PM UTC
Can you respond to my not finding SaveNativePDFToBlob in powerscript?
  1. Helpful
  1. Mark Goldsmith
  2. Tuesday, 12 October 2021 14:12 PM UTC
Hi Pete...I don't think that became available until PB 2017R3

Regards,

Mark
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Monday, 11 October 2021 17:17 PM UTC
  2. PowerBuilder
  3. # 2

The SaveAs method uses Ghostscript which is a virtual printer. Perhaps printing is being blocked.

You could use the SaveNativePDFToBlob method and then write the resulting blob to disk with FileWriteEx.

 

 

 
Comment
  1. Roland Smith
  2. Monday, 11 October 2021 19:43 PM UTC
To use SaveAs PDF! you need to first install Ghostscript and add a printer named 'Sybase DataWindow PS'. The virtual printer generates a PostScript file and then feeds that and the passed file name to Ghostscript which renders a PDF from the PostScript file. If you haven't installed Ghostscript or added the printer, SaveAs PDF! will not work.
  1. Helpful
  1. Pete Yankovich
  2. Monday, 11 October 2021 20:11 PM UTC
I understood that beginning with 2017 R2, the Sybase DataWindow PS printer was no longer required. The app has been creating PDF's using SaveAs for 2-3 years since 2017 R2 was implemented without the printer.

On another note concerning your alternate method, my installation of PB 2017 R2 says SaveNativePDFToBlob is unknown. I'm using with data store.
  1. Helpful
  1. Roland Smith
  2. Monday, 11 October 2021 20:17 PM UTC
I forgot about that. Add these two lines before the SaveAs:



lds.Object.DataWindow.Export.PDF.Method = '2'

lds.Object.DataWindow.Export.PDF.NativePDF.UsePrintSpec = 'Yes'



Without this code, you have to set each DataWindow to NativePDF manually.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.