OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Applications => Topic started by: Dariusz Piatkowski on March 25, 2017, 10:38:38 pm

Title: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on March 25, 2017, 10:38:38 pm
I have been using native GSView and Ghostscript for a number of years now. Even though Lucide has come along nicely I still experience pretty regular printing issues with it (see http://trac.netlabs.org/lucide/ticket/342 (http://trac.netlabs.org/lucide/ticket/342))...so I rely on Ghostveiw/script to always come through with a good hard-copy output.

The current working setup is made up of:

1) GSView 5.0 (2012-01-07 release)
2) Ghostscript 9.04

I installed the current RPM package of Ghostscript, that being 9.18. I then modified the setups in GSView so re-point it to the RPM version of the install.

1) Working setup of GSView
"Ghostscript DLL:"
=> G:\APPS\GENERAL\GSTOOLS\gs9.04\bin\gsdll2.dll

"Ghostscript Include Path: "
=> g:\apps\general\gstools\gs9.04\resource\Init;G:\apps\general\gstools\gs9.04\lib;g:\apps\general\gstools\gs9.04\resource\Font;g:\psfonts;

"Ghostscript Options:"
=> -dNOPLATFONTS -sFONTPATH="g:\psfonts;g:\apps\general\gstools\gs9.04\resource\Font"

2) NEW setups of GSView
"Ghostscript DLL:"
=> G:\usr\lib\gsdll2.dll

"Ghostscript Include Path: "
=> G:\usr\share\ghostscript\9.18\resource\init;G:\usr\share\ghostscript\9.18\lib;G:\usr\share\ghostscript\9.18\iccprofiles;

"Ghostscript Options:"
=> -dNOPLATFONTS -sFONTPATH="g:\psfonts;G:\usr\share\fonts\default\ghostscript;G:\usr\share\fonts\default\type1"

This gave me a working display of the PDF, meaning, GSview has no problems properly rendering the PDF files. The only issue I actually have is the ability to print. Specifically, any attempt to do so produces the following error message:

=== START ===
GPL Ghostscript 9.18 (2015-10-05)
Copyright (C) 2015 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Unknown device: pswrite
  ./base/gsicc_manage.c:1086: gsicc_open_search(): Could not find default_gray.icc
| ./base/gsicc_manage.c:1706: gsicc_set_device_profile(): cannot find device profile
Unrecoverable error: unknownerror in .special_op
Operand stack:
    defaultdevice
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
gsapi_exit returns 0
DosFreeModule returns 12
=== STOP ===

Because of the message above (...could not find default_gray.icc...) I included the matching directory in the Include Path setup, that being: "G:\usr\share\ghostscript\9.18\iccprofiles;". Still, this has had no impact, the error remains.

So I'm curious how have others proceeded in this migration step? Have you completely un-installed Ghostview? Have you made any other changes?

Thanks as always!
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Andi B. on March 26, 2017, 01:53:34 pm
I've -
Quote
"Ghostscript DLL:"
=> G:\usr\lib\gsdll2.dll
p:/usr/lib/gsdll2.dll

Quote
"Ghostscript Include Path: "
=> G:\usr\share\ghostscript\9.18\resource\init;G:\usr\share\ghostscript\9.18\lib;G:\usr\share\ghostscript\9.18\iccprofiles;
p:/usr/lib

Quote
"Ghostscript Options:"
=> -dNOPLATFONTS -sFONTPATH="g:\psfonts;G:\usr\share\fonts\default\ghostscript;G:\usr\share\fonts\default\type1"
-dNOPLATFONTS -sFONTPATH="m:/psfonts;p:/usr/share/fonts/default/Type1"

M: is my boot drive, P: is my %UNIXROOT%

I'm pretty sure printing worked some times ago but now I get the same error message than you. Time to fill an issue I think.

Btw. at least font path may need slash instead back slash.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: ivan on March 26, 2017, 10:47:27 pm
I have just had a look at this thinking I might be able to update our systems.

I unpacked the RPM and had a look at the files to see if they could be transferred to the standard gs directory structure.  They can, but, as usual there are other DLLs required. 

Now I need to find jpeg.dll, lcms22.dll, cupsim.dll and cupc.dll.  I assume the last two are to help with integration into cups printing but the question is which versions of all those.

Maybe you need to check if you have those DLLs in your libpath. 
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on March 27, 2017, 04:56:01 am
Hi Andi,

...I'm pretty sure printing worked some times ago but now I get the same error message than you. Time to fill an issue I think.

Btw. at least font path may need slash instead back slash.

I tried your settings, no difference. This includes the fwd-slash instead of back-slash.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on March 27, 2017, 04:59:31 am
Hi ivan,

...Now I need to find jpeg.dll, lcms22.dll, cupsim.dll and cupc.dll.  I assume the last two are to help with integration into cups printing but the question is which versions of all those.

Maybe you need to check if you have those DLLs in your libpath.

I find all but one of the DLLs you listed in my \usr\lib path, which is the target DLL path for RPM installer on my system. Only the cupc.dll is missing.

If I remember correctly, the cups-libs RPM package was installed along with the ghostscript RPM package. As well, the ghostscript-fonts RPM was another pre-requisite.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dave Yeo on March 27, 2017, 05:55:39 am
I can't find cupsc.dll on an ArcaOS instal either, seems to have all the other cups and ghostscript stuff.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: ak120 on March 27, 2017, 11:56:35 pm
It's quite possible that colour maps are totally broken the same way as generation of printer lists in the latest RPM packages. When installing gs-9.18 to naked system there's a directory "\usr\share\ghostscript\9.10\Resource\CMap" created from package poppler-data-0.4.7-1.oc00.noarch with some kind of links to required files. The directory "\usr\share\ghostscript\9.18\Resource\CMap" from gs-9.18 is empty.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: ak120 on March 28, 2017, 01:46:18 am
Rozwiązanie rosyjski:

1. Skopiuj plik z \usr\lib\gsdll2.dll do \usr\bin
2. Start programu GVPM.EXE
3. Wybierz z menu "Options" - "Easy Configure"
4. Dalej - Katalog X:\USR !!! - dalej ... do końca
5. Nowy plik o nazwie PRINTERS.INI została wygenerowana / i ewentualnie \OS2\GVPM.INI
6. Restart GVPM - Otwórz plik PDF - Druk - Lista urządzeń zawiera teraz ps2write

Powodzenia! Przepraszam za mój katastrofalnej języka polskiego.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on March 28, 2017, 05:10:16 am
Hi Andreas!

Rozwiązanie rosyjski:

1. Skopiuj plik z \usr\lib\gsdll2.dll do \usr\bin
2. Start programu GVPM.EXE
3. Wybierz z menu "Options" - "Easy Configure"
4. Dalej - Katalog X:\USR !!! - dalej ... do końca
5. Nowy plik o nazwie PRINTERS.INI została wygenerowana / i ewentualnie \OS2\GVPM.INI
6. Restart GVPM - Otwórz plik PDF - Druk - Lista urządzeń zawiera teraz ps2write

Powodzenia! Przepraszam za mój katastrofalnej języka polskiego.

Wow my friend...that is SUPERB!!!

So the only - shall we say - un-clear step is #4, as it literally translates to:

"4. Further - Catalog X:\user !!! - further...until the end"

...and try as hard as I did...I just couldn't make sense of it...hmmm....???

Anyways, I tried this, however the "Easy Configure" always ended up in a FAIL...and the GVPM.INI itself was never re-written.

I did take a stab at that file manually, modified the following 'GhostscriptEXE' section, since adjusting it from within GSView (using the Advanced Config option) did not make any changes:

OLD
===
[GSview-5.0]
Configured=1
GSversion=910
Version=5.0
GhostscriptDLL=G:\usr\lib\gsdll2.dll
GhostscriptEXE=G:\APPS\GENERAL\GSTOOLS\gs9.04\bin\gsos2.exe
GhostscriptInclude=G:\usr\share\ghostscript\9.18\resource\init;G:\usr\share\ghostscript\9.18\lib;G:\usr\share\ghostscript\9.18\iccprofiles
GhostscriptOther=-dNOPLATFONTS -sFONTPATH="g:\psfonts;G:\usr\share\fonts\default\ghostscript;G:\usr\share\fonts\default\type1"

NEW
===

[GSview-5.0]
Configured=1
GSversion=910
Version=5.0
GhostscriptDLL=G:\usr\lib\gsdll2.dll
GhostscriptEXE=G:\usr\bin\gsos2.exe
GhostscriptInclude=G:\usr\share\ghostscript\9.18\resource\init;G:\usr\share\ghostscript\9.18\lib;G:\usr\share\ghostscript\9.18\iccprofiles
GhostscriptOther=-dNOPLATFONTS -sFONTPATH="g:\psfonts;G:\usr\share\fonts\default\ghostscript;G:\usr\share\fonts\default\type1"

...unfortunately, even with the corrected path to the gsos2.exe file it still failed to print.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Andi B. on March 28, 2017, 08:26:00 am
Printing problem is cause psprint is not upported anymore by GS. See tickets at netlabs and Pauls Mantis. Ps2printer should be used intead. But at least for me it does not work. Someone who is willing to work on GSView/GSVPM is needed...
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: roberto on March 28, 2017, 09:11:03 am
I do not in Gsview, but in lucide I install poppler-legacy-63 ver 0.47.0-1  for a correct print
Sorry, the poppler-legacy-63 is for plugins in lucide, not for print. The last poppler-legacy-65 fail in plugins with lucide.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: ak120 on March 28, 2017, 12:11:59 pm
So the only - shall we say - un-clear step is #4, as it literally translates to:

"4. Further - Catalog X:\user !!! - further...until the end"

...and try as hard as I did...I just couldn't make sense of it...hmmm....???

Anyways, I tried this, however the "Easy Configure" always ended up in a FAIL...and the GVPM.INI itself was never re-written.

Simply put "X:\usr" to the upper entry field (second dialogue) for "In which directory...". With X for your specific drive letter. No other modifications are required. The Easy configure routine will add "bin" to it internally. Thats crucial to get the device list in printer.ini rebuilt.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on April 02, 2017, 03:44:37 am
Well you guys...after several hrs of trying all sorts of things, reviewing some of the older ticket on Paul's site (Mantis), etc, etc...I come to the conclusion that Andi did, namely: GSView is the culprit as the newer ghostscript releases no longer support 'pswrite'.

Sooo...I suppose given that I continue to have Lucide printing problems I will take a stab at the GSView source...no idea how complex (or not) it is...but maybe i can decipher it??? lol
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on April 02, 2017, 04:01:18 pm
So guys...I looked at the source, granted, just preliminary stuff, but given what I see I conclude that I must be missing something because the change seems literally trivial, help me out please.

Here is a section of the code, which as best as I can tell sets up the output device, it is identified with the following comments:

/* gvcprn.c */
/* Printer module of PM and Windows GSview */

=== START ===
...
    if (convert) {
   device = option.convert_device;
   resolution = option.convert_resolution;
    }
    else if (method == PRINT_GDI) {
   switch (option.print_gdi_depth) {
       case IDC_COLOUR:
      device = "bmp16m";
      break;
       case IDC_GREY:
      device = "bmpgray";
      break;
       default:
      device = "bmpmono";
      break;
   }
   resolution = "300";   /* fix later */
    }
    else if (method == PRINT_PS) {
   device = "pswrite";
   resolution = "600";   /* a guess */
    }
    else {
   device = option.printer_device;
   resolution = option.printer_resolution;
    }
...
=== STOP ===

See that reference to 'pswrite' when the print method is set to PRINT_PS (I assume PostScript printer selection)?

I will simply change that to 'ps2write', re-compile and report back on the results...seems just too easy though, no???
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Pete on April 03, 2017, 02:53:15 am
Hi All

Thought I'd seen something about pswrite somewhere. From the gs9.15 readme:-

4) GSView requires manual changes to the Ghostscript Include statement
(Options->Advanced Configuration) - I used
'c:\gs\gs9.15\resource\init;C:\GS\gs9.15\lib;C:\GS\gs9.15\Resource\font;C:\GS\fonts;c:\psfonts;'
to make it work
5) the pswrite device that GSView uses to print has been removed from
Ghostscript 9.x. To print using ghostview, modify x:\os2\gvpm.ini and replace
all cases of pswrite with ps2write


Regards

Pete
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: ak120 on April 03, 2017, 09:53:53 pm
I don't know why so many complicated hacks and workarounds came up here, which simply will not solve the original problem. To keep it simple:
1. Better use the official GSview 4.9, which is not broken
2. Go the "Easy" route that I outlined earlier, to get an updated printer.ini/gvpm.ini
3. After all you can do the fine-tuning of the paths
For what reason step 3 should be done first?
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on April 06, 2017, 01:59:29 am
Hi Andreas,

I don't know why so many complicated hacks and workarounds came up here, which simply will not solve the original problem...

In the screenshot you included it looks like you do not use a Postscript printer...my issue is specific to such a printer...therefore, happy to try GSView 4.9 (no harm in going there), but having tried this with 5.0 precisely how you spelled it out the results were not good, ie no working Postscript solution.

Help me/us out though...why do you belive GSView 5.0 is "broken" anyways?

Is it because you have tried these exact steps with 5.0 and could only get them working with 4.9?
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: ak120 on April 13, 2017, 02:32:32 pm
It's quite useless to reply to those false claims. Before posting here I checked everything twice also with the broken GSview 5.0 and as everybody can see from the image also with PostScript printers. Of course only with printers that support Level 2 or 3 of the PostScript language. If you still want to print with GSview to an older PostScript printer you should use the latest GS version which supports the pswrite device.

GSView 5.0 doesn't support OS/2 as everybody can read. Neither the gs 9.18 hack nor the gsview 5.0 hack are supported. The best advise I can give is to never follow any instruction from the half-RPM almost non-existing docs.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Andy Willis on April 20, 2017, 02:39:13 am
I am using Paul's GS 9.15 and gsview 5.0 and am able to print to both PScript and PCL printers using os2prn rather than pswrite or ps2write.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on April 20, 2017, 05:11:36 am
Hi Andy,

I am using Paul's GS 9.15 and gsview 5.0 and am able to print to both PScript and PCL printers using os2prn rather than pswrite or ps2write.

Would you mind posting your INI files? I have not gone back to attempt to compile the modified version of GSView...my development environment is primarily VAC, so I have to do an EMX setup first. I did also receive a response from Russell Lang who stated:

"...Note that pswrite is not hard coded into GSview.  It's just one of the devices for which that GSview pre-populates some configuration option.  You can add ps2write without recompiling GSview.  Just add it from the GUI, or edit the gvpm.ini file to add it (probably quicker)..."

I am hoping to continue that conversation with him. While the responses in this thread are very welcome, most of them have been a YEY/NAY type of a thing, no one has actually spelled out what specifically needs to be changed and where, meaning, the exact details of let's say gvpm.ini file, so far that means I am nowhere further to working through this.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Pete on April 20, 2017, 12:42:03 pm
Hi Dariusz

Please find attached gvpm.ini for using gsview 5.0 with ghostscript 9.15; ps2write lines added.

Yes, gsview 5.0 prints fine using (non-rpm) cups.


Hope that is of help.


Regards

Pete
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Andy Willis on April 21, 2017, 05:54:16 am
Hi Andy,

I am using Paul's GS 9.15 and gsview 5.0 and am able to print to both PScript and PCL printers using os2prn rather than pswrite or ps2write.

Would you mind posting your INI files? I have not gone back to attempt to compile the modified version of GSView...my development environment is primarily VAC, so I have to do an EMX setup first. I did also receive a response from Russell Lang who stated:

"...Note that pswrite is not hard coded into GSview.  It's just one of the devices for which that GSview pre-populates some configuration option.  You can add ps2write without recompiling GSview.  Just add it from the GUI, or edit the gvpm.ini file to add it (probably quicker)..."

I am hoping to continue that conversation with him. While the responses in this thread are very welcome, most of them have been a YEY/NAY type of a thing, no one has actually spelled out what specifically needs to be changed and where, meaning, the exact details of let's say gvpm.ini file, so far that means I am nowhere further to working through this.
I built gsview 5 with the klibc gcc, not emx... not sure what is needed to build it with emx.
I did edit the ini files in an attempt to see if I could use ps2write as a result of this thread but the os2prn is stock.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dave Yeo on April 21, 2017, 07:05:24 am
I built gsview with EMX a long time back, the only problem I had back then was finding the zip.dll (or was that unzip.dll) requirement. Of course that was before the stdint types were common and gsview probably had EMX fixes in its tree.
In the case of Dariusz, he's probably using EMX as a synonym for GCC.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on April 27, 2017, 08:58:13 pm
Hi Pete,

...Please find attached gvpm.ini for using gsview 5.0 with ghostscript 9.15; ps2write lines added.

Yes, gsview 5.0 prints fine using (non-rpm) cups...

Well, the only difference in mine and your gvpm.ini was the actual directory location where gvpm is installed. I updated accordingly (your file), tried it, nope, same result. So I suspect there is some other issue here that I have not discovered yet.

I have not had the time to sit-down and attempt the emx build...I was actually thinking this was different from a gcc build, only since the emx runtime seems to be required. Since then I reviewed the Developer guide and I think I understand this a bit better.
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Pete on April 29, 2017, 06:15:55 am
Hi Dariusz

Are you using cups as the printer driver?

Just asking as I have run into a bit of a printing problem with cups which seems to centre around gstoraster and involves gs 9.18-5 so I'm wondering if the problems are related.


Regards

Pete
Title: Re: Migrating from native Ghostscript to RPM packaged one...
Post by: Dariusz Piatkowski on April 29, 2017, 03:03:40 pm
Hi Pete,

...Are you using cups as the printer driver?...

Not at all...good ol' fashioned PS Printer, Brother HL5470dw using native PSCRIPT as well as the updated PSPRINT drivers...