Skip to Content
** “Kool” Tip **

GhostScript on Windows 10

PDF Generation for PowerBuilder Classic

 

   Most PowerBuilder developers know that the DataWindow object class in PowerBuilder (PB) Classic utilizes the open source (GNU) version of the GhostScript (GS) software to convert PostScript printer output into an Adobe PDF (Portable Data Format) file. The challenge this year for PB Developers moving into the MS-Windows version 10 domain, is that all drivers must be signed in order for the new O/S to accept the driver. This creates an issue for the GS installation as even the latest version 9.16 does not supply signed MS-Windows drivers.

  The good news though is that the PB Developer can get around this roadblock in the new O/S by following the procedure I used below to install GS v9.16. Without this technique, the GS install will not complete due to finding an unsigned driver. The install will in fact get stuck in a closed loop … select the .INF, get an unsigned driver message, click next, get an unsigned error and voila – your back at the select the .INF file part again in the MS-Windows 10 install printer wizard!

   The following procedure is what I used to circumvent the unsigned GS driver issue in W10, as follows:

1) Hold down the SHIFT key while you click Restart.

2) Once your computer has rebooted, choose the Troubleshoot option.

 

3) Then select the Advanced options.

4) You will now be prompted to restart your Computer again.
5) After restarting, you will need to press the F7 key!

6) Now your PC will reboot and you will be able to install unsigned drivers without any error messages! 

Now during the GhostScript installation, once you get to selecting the printer driver from the GS installation’s LIB folder, you should now see the MS-Windows security dialogue allowing the GS Driver to be installed even though its not signed!

    I have now implemented the above procedure on two W10 PC’s and have successfully built PDF files from PB 12.1, 12.5.1 and 12.6 running on W10. I hope that this information will help you in your PB adventure into the W10 realm.

Regards … Chris

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. David Peace

    Nice post Chris,

    I wish we had this a couple of weeks ago. We have already broken this pain barrier as we test our latest release on W10.

    I’m sure this will help a lot of people.

    Cheers

    David

    (0) 
    1. Chris Pollach Post author

      Thanks David!

          Yes, I had to scratch my head a few times (and loose some more hair) to finally find the real issue and a work around. However, after a few Tim Horton’s coffees 😉 I was able to get the above to work. One happy camper I tell ya!

         For production I would recommend looking at getting the GS driver signed. You can do that using various pieces of software. For example;  Steps for Signing a Device Driver Package

        The other alternative is to even go one step further and take GS out of the client picture and thus the entire W10 GS problem (for example – click here)

      Regards … Chris

      PS: I am hoping that Appeon will embed their native PDF support into PB when SAP officially hands the product over to them soon.   😉

      PPS: I believe that the above procedure will also work on W2012.

      (0) 
      1. Antony Xavier

        Hi Chris,

             Nice Post thank you verymuch.

             I have one issue while am saving dw using GS printer to a file, name as arabic ( ‘اختبار.pdf’ ),  content is not saving so file size is 0, can you advice/ guide me.

           

             FYI:- English Named Files are working fine with while saving DW.

             the following message am getting while I try to open file.

        /wp-content/uploads/2015/10/gspdf_problem_815569.jpg

        Thanks in advance.

        Regards

        Antony

        (0) 
        1. Chris Pollach Post author

          Hi Anthony;

            I have never had to look into the Arabic support for GS here in Canada as we only support English & French. However, its my understanding that the LATIN-1 fonts that GS comes with & uses do not contain the Arabic character set. Thus, you might need to download some Arabic postscript based fonts for GS to use.

          HTH

          Regards … Chris

          (0) 
  2. David Peace

    Morning Guys

    I have a really weird one. I have an application that when saving DWs with Saveas PDF! On Windows 10 is changing the default printer to the Sybase DW printer.

    I never seen this before and cannot see what might be causing it…. has anyone else had this experience?

    Cheers David
     

    (0) 
    1. Chris Pollach Post author

      Hi David;

      Yes, I have encountered this before on W10 and the odd W7. What I always try to do now is reset the default printer after a SaveAs (PDF!), as follows:

      String  ls_printer

      ls_printer = PrintGetPrinter ( )
      DC/DS.SaveAs (PDF!)
      PrintSetPrinter (ls_printer)

      HTH
      Regards … Chris
       

      (0) 
  3. John Vanleeuwe

    Hi guys,

    I have read the recent posts about powerbuilder and ghostscript.

    I have downloaded GS v.9.20 for a windows2012 R2 installation , PB11

    Anyone got GS sybase datawindow PS working on a windows 2012 R2 please ? If yes, which gs version ? Any manual changes to perform to make this work ?

    Been looking at this issue for 2 days straigth 🙁

    TIA
    John
     

    (0) 
  4. David Peace

    We solved this. It is a setting in Windows 10 to retain the last used printer as the default. Nothing at all to do with PB or ghostscript. Change the setting in Windows 10 and it is all ok.

    Cheers

    David

    (1) 
  5. Kim Nguyen

    Dear Chris,

    I followed your instruction carefully:

    1) Download and install GS 8.71 64 bit version.

    2) Install GS 8.71 and make sure that you set the GS_DLL environment variable …

    ie: GS_DLL=C:\Program Files\GS\gs8.71\bin

    3) Install the “Sybase DataWindow PS” printer from the GS 8.71 64 bit .INF file located in the GS install’s LIB sub-folder

    4) Optional: Add the GS BIN folder to your system path

    5) Reboot your PC.

    Now, PDF support should be working in PB 10 and higher on your 64 bit MS-Windows machines.

    Note: v8.71 of GS has some key fonts that are not included in later releases of GS and these fonts are also no longer included with newer MS-Windows versions either. So what ever you do … never delete GS 8.71 from your machine.

    You can now upgrade GS as follows:

    1. a) Download and install the latest GS version 9.x or higher 64 bit version

    Do not uninstall GS 8.71

    1. b) Install GS 9.x and make sure that you set the GS_DLL environment variable …

    ie: GS_DLL=C:\Program Files\GS\gs9.01\bin  (for example)

    1. c) Delete the old “Sybase DataWindow PS” printer definition
    2. d) Install a new “Sybase DataWindow PS” printer from the GS 9.x 64 bit .INF file located in the GS install’s LIB sub-folder.
    3. e) Optional: replace the GS 8.71 BIN folder in your system path with the GS 9.x BIN location.
    4. f) Reboot your PC.

    FWIW: This procedure works for me and all my clients every time! Tested with PB 10.5 through all versions to PB 12.5.2

    HTH

    Regards … Chris

    But it sill does not work, do you still have any other solution to saveas() to PDF?

    I am trying : WIndows 10 or Windows 8.1 – PowerBuilder 10 – Ghostscript 8.71 and 9.21.

     

    Please help !!!

     

    Kim

    (0) 
  6. Chris Pollach Post author

    Hi Kim;

    Since I posted that procedure, GhostScript have added the missing fonts to their recent GS installations. So if you are using for example GS version 9.19 or higher – you should not need to install GS 8.71 first, nor leave old GS installations around once you are on the latest release.

    HTH

    Regards … Chris

    PS: As of this posting, the current version is 9.21 … https://ghostscript.com/download/gsdnld.html

     

    (0) 

Leave a Reply