1. Olan Knight
  2. PowerBuilder
  3. Tuesday, 30 November 2021 00:54 AM UTC

PowerBuilder 2019R3, b2703
Oracle 12C and PostgreSQL v12
IDE:       Windows 10 64 bit o/s
Runtime: Windows 19 server


What components are required to get the SAVE AS into a PDF file to work correctly?
Do I need the Sybase Datawindow PS driver? If so, is there an installer for this?
Any specific DLLs?
Ghostscript?
Anything else?

I'm having serious difficulty getting this to work on the Windows 19 server.


Thank You,

Olan

Who is viewing this page
Accepted Answer
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 15:30 PM UTC
  2. PowerBuilder
  3. # Permalink

Create a function with the below code in your base datastore/datawindow object called SaveAsNativePDF that returns integer and has string as_filename as the argument.

 

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

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

Return this.SaveAs(as_filename, PDF!, True)

 

This will save the report to a PDF file using the built in NativePDF feature.

 

Comment
  1. Olan Knight
  2. Tuesday, 30 November 2021 17:18 PM UTC
Fabulous!

Thanks, Roland, that is exactly what I need. WIll try it out right now.
  1. Helpful
  1. mike S
  2. Tuesday, 30 November 2021 17:57 PM UTC
you can also set save as native pdf as the default in your application object settings.
  1. Helpful 1
  1. Olan Knight
  2. Tuesday, 30 November 2021 18:16 PM UTC
Roland, that worked perfectly right out of the box.

Thank you!
  1. Helpful
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 22:28 PM UTC
  2. PowerBuilder
  3. # 1

Roland -

   The code you provided works perfectly - thank you again - but it ONLY creates PDFs from those DWOs whose margins fall within 8".  If I have a DWO whose populated width is 17" margins, the PDF does not get created.

   I expect that over-wide pages on a PORTRAIT print setting will be automatically broken into  multiple pages, and that's not occurring.

   Is there a setting I need to tweak? An option I need to set?

Thanks,

Olan

 

 

Comment
  1. Chris Pollach @Appeon
  2. Wednesday, 1 December 2021 16:13 PM UTC
Hi Olan;

I would try ....



DC.Modify("DataWindow.Print.Paper.Size='3'") // Tabloid 11x17 or 4 - Ledger 17x11

DC.Modify("DataWindow.Print.Orientation= '1'" ) // Landscape

DC.Modify("DataWindow.Export.PDF.NativePDF.UsePrintSpec=Yes") // Use Settings in Print Specification



HTH .. Regards ... Chris
  1. Helpful 1
  1. Olan Knight
  2. Wednesday, 1 December 2021 16:25 PM UTC
Thanks, Chris.

  1. Helpful
  1. Olan Knight
  2. Wednesday, 1 December 2021 18:27 PM UTC
This was resolved when I recompiled the code.

Just one of those things, I guess.... :/
  1. Helpful
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 18:06 PM UTC
  2. PowerBuilder
  3. # 2

Just some random question which might not have anything to do:

Is there a default printer installed for the user that runs the applicaion on the windows 2019 server? Not sure if that's still important.

regards

Comment
  1. Olan Knight
  2. Tuesday, 30 November 2021 18:19 PM UTC
Yes, there is a default printer currently assigned but the problem is that it's this customized PDF driver that was written for us 20 years ago - and that is the ONLY printer on the 2019 server. Sadly, we don't have access to the source code.



Implementing the solution Roland provided resolved the situation for the SAVE AS command.



Now I'm working on getting the PRINT command to work properly on these new servers. :/

  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 15:44 PM UTC
  2. PowerBuilder
  3. # 3

"I'm having serious difficulty getting this to work on the Windows 19 server."

this implies that you get it to work on other machines?  Does it work on other machines that are not your development machine?

 

 

 

Comment
  1. Olan Knight
  2. Wednesday, 1 December 2021 16:26 PM UTC
Yes. Running on 2016 server and 2012 server the PDF engine works perfectly and the PRINT and SAVE AS commands work as expected.
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 1 December 2021 17:49 PM UTC
IF when you say that, you are using ghost script and NOT native pdf, then maybe you have to install something (ghost script) on the 2019 server?
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 30 November 2021 01:46 AM UTC
  2. PowerBuilder
  3. # 4

Hi Olan;

  Is there a reason that your trying to use the old Ghostscript PDF rendering technique vs the newer NativePDF PB built-in feature?

Regards ... Chris

Comment
  1. Olan Knight
  2. Tuesday, 30 November 2021 17:19 PM UTC
Carryover code, mostly.

That, and I am not familiar with the Native PDF functionality.

Finally, I was trying to stay with the old code until the bugs were mostly resolved with the Native PDF processing. :)
  1. Helpful 1
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.