cancel
Showing results for 
Search instead for 
Did you mean: 

Creating pdf files in powerbuilder 12.1 classic on win 7

Former Member
0 Kudos

I'm trying to get the gnu ghostscript working on my win 7 (64-bit) machine.

I installed gs860w32

and, tried to saveas a pdf in a couple of different ways

dw_report.Object.DataWindow.Export.PDF.Method = Distill!

dw_report.Object.DataWindow.Export.PDF.Distill.CustomPostScript="No"

dw_report.saveas('',PDF!, FALSE)

or, just as a saveas PDF!

both produced an error in adobe reader

that it couldn't open the file because, either it's not a supported file

or, it's been damaged

I've seen a lot of different suggestions on how to implement this

Any ideas? suggestions?

is there a step by step set of instructions, that will help me get this working?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Scott;

Note1: new GS version and newer MS-Windows have a flaw in that they are missing the fonts needed to allow GS to work properly.

Note2: many people think that because PB is 32 bit - you need to use the 32bit version of GS. This is a misnomer.

Here is how I do it and I have GS working on W7, W8, W2008R2 and W2012 ...

Part I

1) Download the 64bit version of GS version 8.71.

   - Has the missing fonts needed

   - You must use a 64bit version of GS on a 64bit version of MS-Windows.

FYI: http://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/8.71/

2) After installing GS v8.71, you need to create the "Sybase DataWindow PS" printer definition.

   - Make sure this is a FILE based printer

   - Do not use the PowerBuilder supplied .INF as listed in Bruce's link

   - Make sure that you only use the .INF file supplied with GS v8.71.

       It should be located in GS's "Lib" sub-folder

3) Create a System Environment variable named "GS_DLL" and map this to the GS's "BIN" Folder location.

  -  ie: C:\Program Files\GS\gs8.71\bin

4) Add the GS's "BIN" folder to your PC's  "system path"

5) Reboot your system, then open the PB Classic IDE and then proceed to the DataBase Painter.

   - Select to display any rows from a table in your DB.

   - In the "Data" pane,use the RHMB and select the "save rows as" popup menu option.

   - Select the file type as PDF and continue - you should now see a valid PDF file created

Note3: What ever you do with GS from now on .. never delete GS v8.71 as you need its font support.

PART II

  If PDF generation is now working from following the steps from Part II, you may now upgrade GS to the current level (see note3).

a)  Download the latest version of GS - say v 9.10

   - make sure that you use only the 64bit version

FYI:  Ghostscript - Browse /GPL Ghostscript at SourceForge.net

b) follow the same installation steps as described above repeating steps #2 through 5.

  - note, you will have to delete your "Sybase DataWindow PS" printer and re-add this using the same instructions I gave you but using the newer GS's .INF installation file.

At this point, your MS-Windows GS installation should good to go. Make sure that you set your PDF DataWindow's "Data Export" properties to:

Format: PDF

Method: Distill!

HTH

Regards ... Chris

Former Member
0 Kudos

Bruce is correct that some versions of PowerBuilder have 'gswin32.exe' hard coded. The 64 bit version of GS is gswin64.exe. You can copy gswin64.exe as gswin32.exe to get around that.

former_member190719
Active Contributor
0 Kudos

Yep, and as the CR indicates, the version that the OP is reporting the problem with is one of the versions that has that limitation (the CR is based on that specific version).

Former Member
0 Kudos

Hi Bruce/Roland;

  Sorry .. but, the CR is wrong.

As you can see from Scot's reply .. the 64bit GS works perfectly. For me, this procedure "nails" the GS installation and execution every time. 

Regards ... Chris

Former Member
0 Kudos

Another Question

turns out, that some of my clients machines are win 7 - 32 bit or XP

do you think that I should make sure that I use the gs???w32 bit version

of the ghostscript

i currently am using gs871w64

but, my person machine is win7 - 64 bit

i don't think I have a 32 bit machine to test this out on

Former Member
0 Kudos

Hi Scot;

  Yes, those environments must definitely only have the 32 bit version of GS installed!

Regards ... Chris

Former Member
0 Kudos

Hi Chris,

Your suggestion works well with me.  Thanks.  I am currently using PB 12.6 and was just wondering why in runtime/debug mode saving to PDF is working without any ghost script installation.  Why only in the compiled one.  Please note that I am using same PC when testing.  Hope SAP can give suggestion on this as some other company does not want to install free software on their environment just like my client now. 

Former Member
0 Kudos

Hi Elena;

1) if your using PB.Net it will work because it uses its own internal PDF rendering engine.

2) PB Classic will work without GS if your DW's are set to use XLFSO instead of DISTILL option. XLSFO uses a Java engine to render a PDF. However, the PDF rendering with this built-in mechanism is often quite poor or incomplete. The Distill option forces the DW to use GS.

3) You cam also use other PDF printer rendering software. I use CutePDF for example. It just requires the DW to be pointed at its Printer definition at .Print() time.

HTH

Regards ... Chris.

Former Member
0 Kudos

Hi Chris,

I am using PB classic and we configured the dw as xflso but it is not working.   When you say mechanism is often quite poor or incomplete you mean that sometimes it will work and sometimes not?  Because if that is the case SAP should identify the issue here to avoid confusion on the solution that we need to provide to the client.  We insist to use GS as this is the only one that works for them but we need to defend it to management  as they don't want to install not licensed/freeware in their environment coz it will violate security policy.

Regards,

Elena

Former Member
0 Kudos

Hi Elena;

1) Correct, XLSFO will render simple DW's OK but often falters on more complex layouts and especially nested / composite DWO styles. 

2) The XLSFO restriction goes way back to the PowerSoft days even before Sybase bought PB - which of course is way before SAP bought Sybase. XLSFO is a well know restriction from way-back-when. GhostScript is the only way to guarantee proper PDF rendering in PB Classic.

FWIW: Appeon - to whom SAP is getting ready to turn the PB product over to - is planning native PDF support in the 1st Appeon PB product release ( check out Webinar #4 ). 

Regards ... Chris

Former Member
0 Kudos

Hi Chris,

Good to hear that, as I believed that the datawindow is one of powerful features that PB has and pdf is almost part of all reports.  Hope also that all the AD details I asked you in the other topic will be included as part of any pb dll as it is a basic details which other developer may not easily understand if working environment has limited resources and lack of infra knowledge.

Thanks so much for sharing knowledge to us, now all my issues are resolved and ready for UAT.

Regards,

Elena

Former Member
0 Kudos

Great news Elena! 

Good luck in Production!  

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

just to say that the wiki page seems to be up to date now. I have (only) installed GS 9.16 (64 bits) from here using .inf file from GS installation to create the printer and everything seems to work fine. Using Powerbuilder 12.5.2 and W2008R2 here. Thanks.

Former Member
0 Kudos

Hi Nacho;

1) The current GS version is 9.19!

2) The official GS download site is here

3) Neither GS v9.16 thru v9.19 will work properly by themselves!  

   => Please keep following my GS installation instructions on SCN!

Note: Tested on W7, W10, & W2012 64bit O/S's and they all fail with GS v9.19!

Regards ... Chris

former_member190719
Active Contributor
0 Kudos

There's a page on the wiki that explains how:

Configuring PB to generate PDFs - SAP PowerBuilder - SCN Wiki

Former Member
0 Kudos

Seems that it's creating my file, but with a file size of zero.

I've tried everything on the link below

i've tried various versions of ghostscript.

the latest was 8.71 described in the below link

seems like I must be missing something.  I created a gs_dll variable, and added the path to the system variable.  I also used the ghostscript inf for the print driver.

Any other ideas?

https://groups.google.com/forum/#!topic/sybase.public.powerbuilder.general/_ihfcf9juh0

former_member190719
Active Contributor
0 Kudos

Did you use the 32bit version of GhostScript?

PowerBuilder is hard coded to call the exe for the 32 bit version of GhostScript.  The 64 bit version has a different name for the exe, so PowerBuilder won't be able to find it.  You could either use the 32 bit version, or rename (or copy and rename) the 64 bit executable to the name that PB is looking for.

Sybase CR 710061

Former Member
0 Kudos

Hi Bruce;

  FYI: That installation procedure is flawed as its based on some old PB ways!

Regards ... Chris

Former Member
0 Kudos

I was originally using the 32 bit version gs871w32

but, I was only getting files with a zero size

I removed it, and installed the 64 bit version gs871w64

my machine is a 64 bit windows version

the 32 bit version was installing it in the sub-directory

C:\Program Files (x86)\gs\gs8.71

whereas the 64 bit was installing it in the C:\Program Files\gs\gs8.71

most of what I've seen, was talking about the c:\program files\gs directory

I didn't know if that was the issue.

or, if there's something else going on there.