cannot edit ghostprint ppd in Windows 10 - ghostscript

I had some difficulty posing my problem in a way that the Title filter found pleasing. The real problem is that modifying only the GhostPDF.PDD file in the GS9.26 installation in Windows 10 doesn't seem to affect the output after a re-installation using Windows 10 Device Installer.
I print to a networked Sun SPARCprinter 1 which is controlled by Ghostprint (script?) compiled to run on SunOS 4.1.4. This has worked successfully for some years printing output from Windows XP using Adobe's PS driver and a SPARCstation PPD cobbled together from samples found on the net.
I've installed Artifex's 9.26 on Windows 10 and output to an LPR printer (The Sun). The output works, is recognized as PS output by the Sun, but produces a number of FATAL errors.
I need to edit the Windows Ghostscript installation to output PS files which are more suitable for the Sun.
So to my simple question: Do I need to modify anything in the Ghostscript Windows 10 installation other than the Ghostpdf.PPD file?
additional info:
SPARCstation 10 information:
SunOS 4.1.4
arcad# gcc -dumpversion
2.95.2 Note: I had to bootstrap this version up from the early GCC which could be compiled with the SunOS 4.1.4 C compiler. I had the impression I couldn't bring it up any further but could be mistaken.
arcad# gs --help
Aladdin Ghostscript 6.01 (2000-03-17)
Copyright (C) 2000 Aladdin Enterprises ...
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-g<width>x<height> page size in pixels | -r<res> pixels/inch resolution
-sDEVICE=<devname> select device | -dBATCH exit after last file
-sOutputFile=<file> select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PDF
.....
For more information, see /usr/local/share/ghostscript/6.01/doc/Use.htm.
Note: I think this is the most recent GS version I can compile with this gcc version
printcap section:
gp|GhostPrinter:\
:lp=/dev/lpvi0:sd=/var/spool/gsprintspool:lf=/var/spool/gsprintspool/log:\
:mx#0:sh:if=/usr/local/libexec/lpfilter-gps:
Typical spool file - "....." indicates stuff not included here"
arcad# more dfA004DESKTOP-M8C5I86
%!PS-Adobe-3.0
%%Title: Document
%%Creator: PScript5.dll Version 5.2.2
%%CreationDate: 12/14/2018 19:56:8
%%For: jferg
%%BoundingBox: (atend)
%%Pages: (atend)
%%Orientation: Portrait
%%PageOrder: Special
%%DocumentNeededResources: (atend)
%%DocumentSuppliedResources: (atend)
%%DocumentData: Clean7Bit
%%TargetDevice: (Ghostscript) (3010) 815
%%LanguageLevel: 3
%%EndComments
%%BeginDefaults
%%PageBoundingBox: 0 0 612 792
%%ViewingOrientation: 1 0 0 1
%%EndDefaults
.....
%%EndResource
userdict /Pscript_WinNT_Incr 230 dict dup begin put
%%BeginResource: file Pscript_FatalError 5.0 0
userdict begin/FatalErrorIf{{initgraphics findfont 1 index 0 eq{exch pop}{dup
length dict begin{1 index/FID ne{def}{pop pop}ifelse}forall/Encoding
{ISOLatin1Encoding}stopped{StandardEncoding}if def currentdict end
/ErrFont-Latin1 exch definefont}ifelse exch scalefont setfont counttomark 3 div
cvi{moveto show}repeat showpage quit}{cleartomark}ifelse}bind def end
%%EndResource
userdict begin/PrtVMMsg{vmstatus exch sub exch pop gt{[
quires more memory than is available in this printer.)100 500
more of the following, and then print again:)100 485
put format, choose Optimize For Portability.)115 470
ce Settings page, make sure the Available PostScript Memory is accur--More--(2%)
ce the number of fonts in the document.)115 440
ocument in parts.)115 425 12/Times-Roman showpage
Error: Low Printer VM ]%%)= true FatalErrorIf}if}bind def end
2016 ge{/VM?{pop}bind def}{/VM? userdict/PrtVMMsg get def}ifelse
.....
SPARCprinter PDD file which works with Adobe PS in Windows XP:
john#hp2:~/sun-stuff/cups-sparc$ more SPARCprinter2.ppd
*PPD-Adobe: "4.1"
*% PostScript(R) Printer Description File for SPARCprinter
*% Date: 94/01/14
*% Copyright 1994 Sun Microsystems, Inc. All Rights Reserved.
*% Permission is granted for redistribution of this file as
*% long as this copyright notice is intact and the contents
*% of the file is not altered in any way from its original form.
*% End of Copyright statement
*% Changed margins on SPARCprinter JAF 3-3-2017
*FormatVersion: "4.1"
*FileVersion: "1.10"
*LanguageEncoding: ISOLatin1
*LanguageVersion: English
*PCFileName: "SPRN.PPD"
*Product: "(SPARCprinter)"
*PSVersion: "(3.000) 0"
*ModelName: "SPARCprinter"
*ShortNickName: "SPARCprinter"
*NickName: "SPARCprinter"
*% ==== Device Capabilities ===============
*LanguageLevel: "3"
*Extensions: CMYK Composite
*FreeVM: "4194304"
*ColorDevice: False
*DefaultColorSpace: Gray
*VariablePaperSize: False
*TTRasterizer: None
*FileSystem: False
..... more of the usual stuff

I don't really understand why you have installed Ghostscript on Windows. Windows is perfectly capable of producing PostScript files all of its own. In addition, the PPD file doesn't actually do very much, it is simply a text file with descriptions of the capabilities of the printer.
So the real problem is, or seems to be, that your SUN setup doesn't like the PostScript being produced by the new version of Windows.
You don't say how you are printing the PostScript file. not how your printer is 'controlled by Ghostscript' (I'm not aware of any product called Ghostprint, there is a GSPrint as part of GSView, but that's really for Windows).
Assuming you are using Ghostscript on your Sparc workstation to drive the pritner, then the most likely problem I would say is that you are using an old version of Ghostscript on the workstation, and it doesn't like the PostScript being generated by the newer version of Windows.
If you had included the transcript from the workstation Ghostscript installation it might be possible to say more but without that I'm rather guessing.
Another possibility is that you are using the ps2write device in Ghostscript to produce PostScript files on Windows. I can't think why you would be doing that, but it sort of fits your description. In that case editing the PPD file will have no effect, because Ghostscript doesn't use it.
Now the ps2write device emits level 2 PostScript, the clue is in the name, and its possible again that your Sparc setup is so elderly that it doesn't understand level 2, or doesn't fully implement it. In which case you will probably get errors. Again, if you were to provide the text of the error messages this would help!
In the latter case, you are frankly out of luck. We dropped support for level 1 PostScript output some time ago, what with level 2 being 28 years old now and level 3 coming up on 20. If you need language level 1 output you will have to go back to a very old version of Ghostscript. Something like 9.07 (from 5 and a half years ago) was the last version that included the pswrite device.
With effort you could take the pswrite device and upgrade it so that it works with the current version of Ghostscript
[EDIT]
My word, that's a really old version of Ghostscript!
You could try building a new version to replace it, but I also don't know if current code will compile on gcc 2.95. It 'should' because we only expect C89, but the third party libraries (which are essential) may very well not compile.
The PostScript file you quoted has been produced by Windows, not by Ghostscript (%%Creator: PScript5.dll Version 5.2.2). So it seems likely to me that your problem is the PostScript being produced by the newer version of Windows doesn't work with your 18 year old version of Ghostscript. That's not actually entirely surprising.
If you look at the DSC comments it says:
%%LanguageLevel: 3
And your Ghostscript information says that it supports language levels 1 and 2. At the time the level 3 spec had only just been published (1999), and clearly the maintainers back then hadn't had time to fully implement it.
Note that the ghostpdf.ppd file is intended for use with Ghostscript as a 'print to PDF' printer along with the RedMon port monitor.
Now its not obvious to me which PPD file you are using, but..... Both the ghostpdf.ppd file and the sparcprinter ppd file have :
*LanguageLevel: "3"
That tells the PostScript driver that it can use language level 3, which your Sparc Ghostscript doesn't support. You could try changing that to:
*LanguageLevel: "2"
and see if that makes a difference (you will have to uninstall the printers from Windows and re-install them with the modified PPD file).
If it doesn't work, the only other thing I can think of is to use the Ghostscript you installed on the Windows system, and preprocess the PostScript file produced by Windows before you send it on. You can use the ps2write device in Ghostscript 9.26 to take in the level 3 file, and produce a level 2 file. It might be a bit bigger, but it ought to work.
To do that on Windows you would use something like:
gswin64c -sDEVICE=ps2write -sOutputFile=out.ps <input.ps>
The file 'out.ps' should then be a level 2 PostScript file. I can't guarantee that the output will then work the old version of Ghostscript on your Sparc, but you stand a chance!

Related

Remote backup of Raspberry Pi sd card from Windows

This references details a procedure for backing up the SD card on a running Raspberry Pi from and to a file on another computer (https://johnatilano.com/2016/11/25/use-ssh-and-dd-to-remotely-backup-a-raspberry-pi/)
To do this from a Windows PC it is necessary to install a new "DD tool" for Windows, also referenced above. I've done all of this and thought I had the process figured out, the following command run from a Windows CMD window does create a file on my Windows PC, but shows an error message which I can not figure out.
c:\Windows\System32>ssh me#192.168.xxx.yyy “sudo dd if=/dev/mmcblk0 bs=1M | gzip -” | dd of=\\.\c:/Users/me/Desktop/rPi_backup.gz –progress
I have run this on my LAN to two different Pi's (3B and 4B), Here is the output from the later after about 30 minutes:
c:\Windows\System32>ssh me#192.168.xxx.yyy “sudo dd if=/dev/mmcblk0
bs=1M | gzip -” | dd of=\.\c:/Users/me/Desktop/rPi_backup.gz
–progress
rawwrite dd for windows version 0.5. Written by John Newbigin This
program is covered by the GPL. See copying.txt for details
0me#192.168.xxx.yyy‘s password:
11,754,655,23215193+1 records in 15193+1 records out 15931539456 bytes
(16 GB, 15 GiB) copied, 2528.86 s, 6.3 MB/s 11,755,209,216Error
reading file: 109 The pipe has been ended
22959393+0 records in 22959393+0 records out
I got the same Error 109 for both Pi's. I have checked the SD cards and they are functional, not corrupted nor have any "dirty bits". I have tried to find the error code description, but nothing I see seems to apply to this situation.
Can anyone help me with this problem. I posted it to the above reference, but have not gotten any meaningful replies....RDK
EDIT after using Maxim Sagaydachny's suggestion (in comments). It worked and I got a .gz file on my desktop. I used BalenaEtcher to expand and copy it to an SD card, same size as that of the source. The Pi booted up but it appears that the restored version is a bit crippled, the Pi boots ok, I can log on (console and SSH) but I get this message just after I log on:
-bash: /etc/profile.d/magnum_path.sh: line 1: syntax error near unexpected token
$'sʧ\237\376\351\370'' -bash: /etc/profile.d/magnum_path.sh: line 1: MA▒$▒g▒p▒[▒kh▒▒▒▒▒D(sʧ▒▒▒▒|▒Kq/t
▒▒▒ ▒9▒$A▒6▒▒f▒▒V▒▒▒Y▒▒ UX▒O:▒▒35▒▒1z▒׎▒YC#▒ȓ!▒ӪW▒▒GM▒
<▒▒'▒▒▒`W=|k▒▒▒V ▒9▒▒R▒[j▒
*▒▒ֈ▒▒
I also noted a message in the bootup screen but it went by too fast to fully read so the following i s a stab at what it really said. Something about the expected number of ?? was, for example, 273 and it only sees 272. And I think it was referencing mmcblk0p2....RDK

Turn off perl-debug-m ansi escape sequences on Windows 7

On Windows 7 cmd.exe, the perl6-debug-m script outputs ansi escape sequences to set the colors, I suppose. How do I suppress these codes or at least make them functional? I'm just getting started with Perl 6 after working with Perl 4 and Perl 5 for over 20 years. I need this to work on Windows because of a program I'm trying to port from Perl 5.
C:\rakudo\bin\lib>perl6 -v
This is Rakudo Star version 2018.04.1 built on MoarVM version 2018.04.1
implementing Perl 6.c.
C:\rakudo\bin\lib>perl6-debug-m
←[35m>>> LOADING ←[0m<REPL 1>
←[34m+ <REPL 1> (1 - 1)←[0m
←[34m| ←[0m←[1;33mREPL←[0m
←[34m> ←[0mquit
←[34m- ←[0mRun END blocks (y/N)?
C:\rakudo\bin\lib>perl6 -V |grep -v "moar:"
distro::auth=unknown
distro::desc=2018-05-20T09:17:12.587605-04:00
distro::is-win=True
distro::name=mswin32
distro::path-sep=;
distro::release=unknown
distro::signature=
distro::version=6.3
kernel::arch=unknown
kernel::archname=unknown-win32
kernel::auth=unknown
kernel::bits=64
kernel::desc=
kernel::hardware=unknown
kernel::name=win32
kernel::release=unknown
kernel::signature=
kernel::version=unknown
perl6::build-date=2018-05-07T10:08:20Z
perl6::codename=
perl6::implementation=Rakudo Star
perl6::language_version=6.c
perl6::libdir=C:\rakudo\share
perl6::prefix=C:\rakudo
perl6::release-number=
perl6::source-digest=688d0872d150048d083b7a499e9fc7a9e8b6ab5b
perl6::version=2018.04.1
repo::chain=inst#C:\Users\danhale\.perl6 inst#C:\rakudo\share\perl6\site inst#C:\rakudo\share\perl6\vendor inst#C:\rakudo\share\perl6 ap# nqp# perl5#
There's currently no way to disable them (I just checked the debugger interface's source to verify that). I've previously used ANSICON on Windows in order to work with applications that produce ANSI color codes, including the Perl 6 debugger, and recall that it rendered them fine.

Ghostscript 'offending input'

When searching for an occurrence of text in a PostScript file, I receive the following error:
gsapi_run_string_continue returns -21
The API documentation specifies that return codes > 0 are "Error" but doesn't describe it any more specifically. Full error console output below - error occurs twice identically, only one occurrence displayed here.
GPL Ghostscript 9.15 (2014-09-22)
Copyright (C) 2014 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Displaying DSC file C:/Users/c-toothm/Desktop/PRDFlow12_30_2014_050307/1230ouptut.ps
Displaying page 1
%%[ ProductName: GPL Ghostscript ]%%
%%[ LastPage ]%%
Extracting text using pstotext...
Ghostscript returns error code -21`
--- Begin offending input ---
evice /pop , d
initmatrix [1 0 0 1 0 0] concat colspSet`
0.00 43.32 +
0.94 0.95 +S
(XSFT2200041.img) run
EPSFILE2200041 restore
;
0 0 0 sco 5 Lw N 4950 4742 M 4800 4742 I K
0 0 0 sco 5 Lw N 4950 4752 M 4800 4752 I K
0 0 0 sco 5 Lw N 4950 4762 M 4800 476
--- End offending input ---
gsapi_run_string_continue returns -21`
[duplicate error redacted]
Our production output creates a giant .ps file every day and this error occurs in many, but not all, .ps files when searching for text. Randomly selected .ps files from the web do not throw the error, so this GS build seems OK - definitely a problem with my file.
What "offending input" is being referred to here and what can I do to address it?
I'd need to see the PostScript file to tell you exactly what is wrong, but 'evice' is not a PostScript operator and so that is likely the problem. Also, from ghostpdl/gs/psi/ierrors.h error code -21 is e_undefined which means the interpreter has encountered an undefined token, which is some confirmation that this is the problem.
This could be because the file contains a 'typo' like that (perhaps it should be setpagedevice or something), or it could be because a filter is improperly terminated, or has insufficient data, and consumes extra bytes from the input stream, chewing up your program.
You should start by using the Ghostscript executable and reproduce the error with that (you might also try the display device, to see whether the problem is related to pstotext), that will allow you to give a command line which other people can then duplicate. With that, and a copy of the offending file I can tell you exactly what's wrong, without it, not much hope.
Bear in mind that PostScript is an interpreted programming language, so its pretty much impossible to tell you what's wrong with your program without seeing the code.
FWIW you might like to try the Ghostscript txtwrite device instead of pstotext, the device doesn't rely on tinkering with the language like pstotext does. pstotext is also really old (the last release is coming up on its 11th birthday) and unsupported.....

Dissappearing characters in youtube-dl, ffmpeg, and windows

so what happens is that if the video title has a symbol that isn't supported by your current locale then ffmpeg won't be able to get to that file properly.
Here's one example
►2 HOURS BEST MELODIC DUBSTEP MIX APRIL 2013◄ ヽ( ≧ω≦)ノ
as you may or may not be able to see, lots of symbols from unicode.
The problem is that in cmd and ffmpeg, though cmd can see
►2 HOURS BEST MELODIC DUBSTEP MIX APRIL 2013◄ ヽ( ≧ω≦)ノ
ffmpeg only sees
2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ
This is the exact error message (i'm using youtube-dl)
[ffmpeg] Adding metadata to 'C:\Music\ToBeDone\2014-06-01\►2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013◄ ヽ( ≧ω≦)ノ.mp4'
ERROR: C:\Music\ToBeDone\2014-06-01\2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ.mp4: No such file or directory
ERROR: WARNING: unable to obtain file audio codec with ffprobe
After some research i've determined that by changing the system locale you can change which symbols cmd can support.
However
ヽ
Used to appear as a box in a question mark in United states locale. In japanese locale it appears as it does on your screen right now.
the problem with
◄
is that even though it's not appearing as a question mark in a box (it's appearing as how it should be), ffmpeg (or cmd) can't detect it properly.
(Refer back to the error message, i'll repost it below.)
[ffmpeg] Adding metadata to 'C:\Music\ToBeDone\2014-06-01\►2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013◄ ヽ( ≧ω≦)ノ.mp4'
ERROR: C:\Music\ToBeDone\2014-06-01\2 HOURS DUBSTEP_DRUMSTEP MIX AUGUST 2013 ヽ(≧ω≦)ノ.mp4: No such file or directory
ERROR: WARNING: unable to obtain file audio codec with ffprobe
So as you can see, I think cmd passed on the symbol correctly to ffmpeg seeing from the adding metadata line, but when it actually does the operation ffmpeg loses
► and ◄
Could this be a bug with ffmpeg? MY workaround so far with incompatible symbols was to change the system locale, but I don't think i can do that with these two symbols...
These are the unique characters that i need to have a locale that supports
Ö
◄ ヽ( ≧ω≦)ノ
( ͡° ͜ʖ ͡°)
(_≧∇≦)
†
【
More info on the problem in general
https://github.com/rg3/youtube-dl/issues/2999
and this is what's going on (Batch Script)
#echo off
setlocal
cd C:\youtube-dl
set /p "var1=Enter URL: " %=% pause
if defined var1 set "var1=%var1:"=%"
set "var2=%date:/=-%"
set "var3=%%(title)s.%%(ext)s"
youtube-dl "%var1%" -ci -o "C:\Music\ToBeDone\%var2%\%var3%" -f best -x --no-mtime --add-metadata
youtube-dl "%var1%" --skip-download -ci -o "C:\Music\ToBeDone\%var2%\Thumbnail\%var3%" --write- thumbnail
youtube-dl "%var1%" --skip-download -ci -o "C:\Music\ToBeDone\%var2%\Description\%var3%" --write-description

ghostscript convert pdf to pcl with wrong orientation

I have an issue trying to convert a pdf document to a pcl document using Ghostscript.
The original pdf document is landscape and so the pcl should be as well. Nevertheless in windows using Ghostscript 9.14 with the following command functions:
gswin32 -dNOPAUSE -dBATCH -sDEVICE=ljet4 -dSAFER -dAutoRotatePages=/NONE -sPAPERSIZE=a4 -sOutputFile=./convert_windows.pcl ./duplicate_windows.pdf
The same command in Ubuntu Linux Kernel Version 3.2.0-40-generic 64 bit - but with Ghostscript 9.05 - results in a wrong orienteated pcl file of size A3 instead of A4 as the original.
The original pdf file contains windows font "arial", which should be available in linux as well. The package "msttorcefonts" is installed on linux. This is an short extract of the fontmap of Ghostscript:
cat /usr/share/ghostscript/9.05/Resource/Init/Fontmap.GS
gives:
% This font, and only this font among the Hershey fonts, uses
% the SymbolEncoding.
/Hershey-Symbol (hrsyr.gsf) ; % 5066567
/Arial /ArialMT ;
/Arial,Bold /Arial-BoldMT ;
/Arial,Italic /Arial-ItalicMT ;
/Arial,BoldItalic /Arial-BoldItalicMT ;
The following listing shows the output of the linux command line, which is the same output as from the windows Ghostscript console!
GPL Ghostscript 9.05 (2012-02-08)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 2.
Page 1
Loading NimbusMonL-Bold font from /usr/share/fonts/type1/gsfonts/n022004l.pfb... 3627296 2211468 1767360 473754 3 done.
Loading NimbusSanL-Bold font from /usr/share/fonts/type1/gsfonts/n019004l.pfb... 3668288 2319461 1807728 497748 3 done.
Loading NimbusSanL-Regu font from /usr/share/fonts/type1/gsfonts/n019003l.pfb... 3800176 2466391 1827912 512832 3 done.
Loading NimbusMonL-Regu font from /usr/share/fonts/type1/gsfonts/n022003l.pfb... 3964224 2617715 1969200 654805 3 done.
Page 2
I alredy tried several options of Ghostscript like
-dFIXEDMEDIA
-dNORAGEPAGESIZE
and others.
When converting the pdf document to ps the result is the same on both environments.
Does anyone has experiences with that issue or an idea?
Thanks in advance and kind regards
Its unlikely anyone can help at all without seeing teh original PDF file, so I would suggest that you open a bug report and attach the PDF file there.
A few observations:
-dAutoRotatePages only has an effect when creating a PDF file, not when interpreting one.
The switch -dFIXMEDIA should be -dFIXEDMEDIA, likewise NORAGEPAGESIZE should be NORANGEPAGESIZE
This may be a possible solution, which works in my case. Precondition: Ghostscript Version 8.6.0 or higher!
Converting pdf to ps not with gs command, but with gs wrapper pdf2ps, which is part of the ghostscript package:
pdf2ps input.pdf output.ps
BUT: For landscape pdf documents this works only since version 8.60 or higher! Otherwise landscape documents will be printed in portrait.
Converting pdf to pcl worked for me using the following command:
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=ljet4 -sPAPERSIZE=a4 -sOutputFile=output.pcl -c "<< /InputAttributes << currentpagedevice /InputAttributes get { pop null } forall >> dup 0 << /PageSize [ 595 842 ] >> put >> setpagedevice" save pop -f input.pdf
BUT: This command is based on the documentation of Bug Bug 689919 of ghostscript (refer to http://bugs.ghostscript.com/show_bug.cgi?id=689919) and works for portrait-orientated documents only if you have installed a version 8.60 or higher. Because I have three different environments I can approve, that this command works since version 8.60. I used Versions 8.16, 8.62 and 9.05.
For versions 8.62 and 9.05 of ghostscript both commands worked properly for pdf --> ps and pdf --> pcl for landscape and portrait.

Resources