[Info-vax] GS convert PDF to PS.

Mark Berryman mark at theberrymans.com
Wed Mar 16 14:32:41 EDT 2022


On 3/16/22 7:38 AM, Jan-Erik Söderholm wrote:
> Den 2022-03-15 kl. 16:36, skrev Mark Berryman:
>> On 3/14/22 10:15 AM, Mark Berryman wrote:
>>> On 3/13/22 9:13 AM, Jan-Erik Söderholm wrote:
>>>> Hi.
>>>>
>>>> I'm new to Ghostscript.
>>>> I try to convert a PDF file to a PS file.
>>>>
>>>> And yes, this a step in the "print a PDF file" project.
>>>> I had some issues with getting the Xerox printer to print
>>>> a plain PDF file so I thought about converting i to to PS...
>>>>
>>>> Have tried with:
>>>>
>>>> $ gs "-dNOPAUSE" "-sDEVICE=ps2write" "-sOutputFile=out.ps" "-fOUT.PDF"
>>>>
>>>> The input file OUT.PDF only contains one page with 6-7 text lines
>>>> and one Code128 barcode. File created from the Python tool Reportlab.
>>>> And "out" refers to the Python step, it is the "input" file to GS.
>>>>
>>>> The PDf file opens fine on any other environment, also when put in
>>>> a VMS directory served by WASD.
>>>>
>>>> I have checked that the file org is as required by GS:
>>>>
>>>>   Record format:      Stream_LF, maximum 0 bytes, longest 16384 bytes
>>>>   Record attributes:  Carriage return carriage control
>>>>
>>>>
>>>> GS just hangs and consumes 100% cpu until I end it with ctrl-C.
>>>> Does it wait for some SYS$INPUT input? Any switch I'm missing?
>>>>
>>>> $ gs "-dNOPAUSE" "-sDEVICE=ps2write" "-sOutputFile=out.ps" "-fOUT.PDF"
>>>> GPL Ghostscript 9.55.0 (2021-09-27)
>>>> Copyright (C) 2021 Artifex Software, Inc.  All rights reserved.
>>>> This software is supplied under the GNU AGPLv3 and comes with NO 
>>>> WARRANTY:
>>>> see the file COPYING for details.
>>>> HV04JES_01 16:01:48 GS        CPU=00:04:01.95 PF=48109 IO=152495 
>>>> MEM=1369
>>>> HV04JES_01 16:01:51 GS        CPU=00:04:04.56 PF=48109 IO=152496 
>>>> MEM=1369
>>>> HV04JES_01 16:01:53 GS        CPU=00:04:06.37 PF=48109 IO=152497 
>>>> MEM=1369
>>>>   Interrupt
>>>>
>>>> $
>>>>
>>>> One empty OUT.PS file is created and some empty TMPDIR files.
>>>>
>>>> _TEMP_T45404.;1       1/52        13-MAR-2022 16:01:45.84
>>>> _TEMP_U45404.;1       0/0         13-MAR-2022 16:01:45.85
>>>> _TEMP_V45404.;1       0/0         13-MAR-2022 16:01:45.85
>>>> _TEMP_W45404.;1       0/0         13-MAR-2022 16:01:45.85
>>>>
>>>> Any ideas? Some simple example for a GS command line to convert
>>>> a PDF file to a PS file?
>>>
>>> You have found a bug.  There is an infinite loop in the code caused 
>>> by a member of a linked list pointing to itself.  Debugging now.
>>>
>>> In the meantime, you might consider downloading XPDF from the VSI 
>>> products site (https://vmssoftware.com/products/list/).  It includes 
>>> a pdftops executable that may do what you want.
>>>
>>> Alternatively, I have found there are a number of printers that 
>>> cannot print PDF files if simply sent to the raw port, or even via 
>>> LPR, but which can print them if the file is sent via IPP.  If you 
>>> have Multinet, try setting up an IPP queue to your printer.  If not, 
>>> you can try my IPP command-line utility.
>>
>> The problem has been found and fixed.  A new kit has been posted.  The 
>> following is an example command that will convert a PDF file to 
>> postscript.
>>
>> gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ps2write -sOutputFile=xx.ps 
>> -f sys$login:v1000_specs.pdf
>>
>> No quotes are needed in the command line because the images are built 
>> with the appropriate DECC feature logicals already set.
>>
>> Mark Berryman
>>
>>
> 
> Did not work without the quotes. I get:
> 
> $ gs -dNOPAUSE -dBATCH -sDEVICE=ps2write -sOutputFile=out.ps -fOUT.PDF
> GPL Ghostscript 9.55.0 (2021-09-27)
> Copyright (C) 2021 Artifex Software, Inc.  All rights reserved.
> This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
> see the file COPYING for details.
> GPL Ghostscript 9.55.0: Cannot open X display `(null)'.
> **** Unable to open the initial device, quitting.
> %SYSTEM-E-BADPARAM, bad parameter value
> $
> 

Is there any chance you don't have SET PROCESS/PARSE_STYLE=EXTENDED set?
That setting is required in order to maintain the case of the command 
line.  Without it, quotes are still needed.

I've had extended parsing as a permanent setting for over 2 decades, 
since the V7.2 days, so I sometimes forget that not everyone uses it.

I get:

$ gs -dNOPAUSE -dBATCH -sDEVICE=ps2write -sOutputFile=out.ps -fOUT.PDF
GPL Ghostscript 9.55.0 (2021-09-27)
Copyright (C) 2021 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Processing pages 1 through 9.
Page 1
Loading NimbusRoman-Regular font from 
%rom%[Resource.Font]NimbusRoman-Regular... 4137464 2656445 2337472 
951768 4 done.
Loading NimbusRoman-Bold font from 
%rom%[Resource.Font]NimbusRoman-Bold... 4203352 2850744 2357576 972426 4 
done.
Loading NimbusRoman-Italic font from 
%rom%[Resource.Font]NimbusRoman-Italic... 4430072 3091238 2478200 
1079748 4 done.
Page 2
Loading Courier font from SYS$COMMON:[SYSFONT.DECW.TYPE1]COUR.PFA... 
4789696 3453069 3583920 2148360 4 done.
Loading StandardSymL font from %rom%[Resource.Font]StandardSymbolsPS... 
4866392 3523388 3604024 2177833 4 done.
Using StandardSymbolsPS font for StandardSymL.
Loading NimbusSans-Regular font from 
%rom%[Resource.Font]NimbusSans-Regular... 5036872 3686310 3644232 
2206500 4 done.
Loading NimbusSans-Bold font from %rom%[Resource.Font]NimbusSans-Bold... 
5223384 3878091 3644232 2213460 4 done.
Page 3
Loading StandardSymL font from %rom%[Resource.Font]StandardSymbolsPS... 
5376776 4024882 2659136 1268618 4 done.
Using StandardSymbolsPS font for StandardSymL.
Page 4
Page 5
Page 6
Loading StandardSymL font from %rom%[Resource.Font]StandardSymbolsPS... 
5735280 4370946 3081320 1668436 4 done.
Using StandardSymbolsPS font for StandardSymL.
Loading NimbusSans-BoldItalic font from 
%rom%[Resource.Font]NimbusSans-BoldItalic... 5925864 4556046 3222048 
1799621 4 done.
Page 7
Page 8
Loading StandardSymL font from %rom%[Resource.Font]StandardSymbolsPS... 
6179776 4808043 3362776 1937933 4 done.
Using StandardSymbolsPS font for StandardSymL.
Page 9
$

Mark Berryman



More information about the Info-vax mailing list