ghostscript option to print duplexs - ghostscript

I have Xerox 7556 printer attached to windows server.
I am trying to use ghostscript commandline to print a pdf to that printer.
I can have it print fine but I want to force it to print duplex regardless of the printer settings.
I have tried C:\Program Files (x86)\gs\gs9.55.0\bin\gswin32c.exe -dDuplex and C:\Program Files (x86)\gs\gs9.55.0\bin\gswin32c.exe -dDuplex=true.
Both just print simplex.
Google has not turned up the documentation for this command.
[EDIT] Add exact sample:"C:\Program Files (x86)\gs\gs9.55.0\bin\gswin32c.exe" -dBATCH -dNOPAUSE -sDEVICE=mswinpr2 -dDuplex -sOutputFile="%printer%\\theprnserv\Office Xerox WorkCenter 7556" "Desktop\SomeDocument.pdf" and we got "Invalid PageMediaType" error message printed rather than the document.

Related

why is ghostscript replacing embedded fonts?

well I've given up. I don't think I understand how GS works... as far as I understand GS replaces all fonts that are not embedded and should not touch already embedded ones? why is it replacing them? I have a pdf file that contains 2 embedded fonts and 1 not embedded (ArialMT).
I'm using command:
"gswin64c.exe -I "C:/Program Files/gs/gs9.56.1/Resource/Init" -sFONTMAP="Fontmap.GS" -dNOSAFER -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=LeaveColorUnchanged -dBATCH -dNOPAUSE -sDEVICE="pdfwrite" -dAutoRotatePages=/None -dPDFA=3 -sOutputFile="pdfa.pdf" "original.pdf"
all I get with this command is this error:
GPL Ghostscript 9.56.1: Actual TT subtable offset xxxxx differs from one in the TT header yyyy. (multiple ones like this)
The following errors were encountered at least once while processing this file:
error executing PDF token
**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> StreamServe Communication Server 16.6.1 GA Build 319 (64 bit) <<<<
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.
the output is a pdf without ANY fonts...
is there any way to force GS not to replace font if it wasn't found on the system?
why is it replacing ArialMT with NimbusSans-Regular even though I have declared a specific path to ArialMT in my FontMap.GS file?
I'd rather not share this pdf file as it contains sensitive customer data.
(osadzony podzestaw=embedded subset)
Ghost Script substitution will require embeddable fonts on windows those are usually stored in C:\Windows\Fonts
Thus if font substitution was simple (without look-up) your command could be simplified
gswin64c.exe -sFONTPATH="C:\Windows\Fonts" -dNOSAFER -sDEVICE=pdfwrite -dNEWPDF=false -dPDFA=3 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=LeaveColorUnchanged -dAutoRotatePages=/None -o"pdfa.pdf" "original.pdf"
you need to add -dNEWPDF=false Since to include additional mapping you add -I "C:/Program Files/gs/gs9.56.1/Resource/Init" -sFONTMAP=Fontmap.gs
Thus the following should be a startpoint
gswin64c.exe -sFONTPATH="C:\Windows\Fonts" -I "C:/Program Files/gs/gs9.56.1/Resource/Init" -sFONTMAP=Fontmap.gs -dNOSAFER -sDEVICE=pdfwrite -dNEWPDF=false -dPDFA=3 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=LeaveColorUnchanged -dAutoRotatePages=/None -o"pdfa.pdf" "original.pdf"
It will not remove warnings using a PDF file from the same developer, the difference was now there is no mention of Nimbus, but the substitutions should be better/fuller as the warning messages verified the fonts were eventually applied from windows
Note the file is smaller although the fonts are embedded, and in side by side comparison they look the same.
GPL Ghostscript 9.56.1: PDFA doesn't allow images with Interpolate true.
and
The following errors were encountered at least once while processing this file:
missing white space after number
error executing PDF token
**** This file had errors that were repaired or ignored.
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.
from their report.
If I save the file from Acrobat the file size drops but the same issues reside

ImageMagick no decode delegate for this image format `PDF' Windows

Trying to play with ImageMagick to read scanned PDF texts, but at the point to convert the PDF to image, I've got this error, where it shows "no decode delegate for this image format `PDF' # error/constitute.c/ReadImage/504". Been search for this solution for hours to no avail, need some help here.
OS: Windows 7 x64
ImageMagick Version: ImageMagick-6.9.8-10-Q16-x86-dll.exe
convert -list format
shows below output
Format Module Mode Description
-------------------------------------------
* native blob support
r read support
w write support
+ support for multiple images
Looks like your delegates are not properly configured,
Once Ghostscript is installed make sure the binary folder C:\Program Files/gs/gs3.0.9/bin is added to your path.
Once Done, there should be a file names delegates.mgk in you graphics magick home directory. Open that file in a text editor.
<delegate decode="pdf" encode="eps" mode="bi" command='"#PSDelegate#" -q -dBATCH -dSAFER -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=#GSEPSDevice# "-sOutputFile=%o" -- "%i" -c quit' />
In the whole file, find and replace #PSDelegate# with gswin64c and it should get the job done.

Ghostscript find out more debugging information

I am creating a pdf file using ghostscript 9.15. I have been using ghostscript for about 5 years and haven’t encountered any serious issues till this week.
Essentially I am running the query below….
“c://distiller/exes/gswin32c.exe" -sDEVICE="pdfwrite" -dNOPAUSE -dBATCH -dNOSAFER -dQUIET -sFONTPATH="C:/Windows/Fonts" -sOUTPUTFILE="C:\distiller\test.pdf" "C:\ExactDistiller \example.ps"
and I get the error below
Current allocation mode is local Last OS error: No such file or
directory Current file position is 197197 GPL Ghostscript 9.15:
Unrecoverable error, exit code 1
I am getting the error “No such file or directory” but I have checked every file path and checked every font is installed and all seems fine but still no luck. I just want to know is there a way of finding out what file / directory is causing the issue?
Well the first thing I would do is not set -dQUIET, turning off information isn't a good way to debug a problem. Not setting -dBATCH and -dNOPAUSE might be helpful too as it might show you more of what is going on. Note that -dNOSAFER is in fact the default, you don't need to set that unless you have previously set your environment to include -dSAFER
In short, when trying to debug the problem, simplify it as far as possible, don't set any switches unless you know you need them, or they contribute to the problem.
You could then paste the stdout transcript which might shed some illumination.
Secondly, your directory appears to contain a trailing space before the separator "c:\ExactDistiller \example.ps", is that correct ? A 'No such file or directory' error will be thrown (without a PostScript error) if you get the input filename incorrect.
If there is a PostScript error revealed when you stop issuing -dQUIET then you can paste it in your original question (by editing it) and I'll take a look. It may be necessary to see your example.ps file, depending on what that reveals.

Ghostscript mswinpr2 does not autoselect the printer

I have created a small script to run my PS file through the windows printer driver for printout.
I use this code:
echo mark /NoCancel true /BitsPerPixel 4 /OutputFile (%printer%%PNAME%) /UserSettings ^<^</DocumentName (%MYDOCNAME%) ^>^> (mswinpr2) finddevice putdeviceprops setdevice>setup.ps
gswin32c -dNOPAUSE -dBATCH -r84 setup.ps %1
The script is creating a setup.ps file as recommended by the gs documentation for the mswinpr2 driver.
It looks like this:
mark
/NoCancel true
/BitsPerPixel 4
/OutputFile (Windows printer name)
/UserSettings
<<
/DocumentName (the text for the job in the spooler queue)
>>
(mswinpr2)
finddevice
putdeviceprops
setdevice
%printer% resolves to the empty string on my machine.
%PNAME% is the name of the windows printer, "C364PS" for me.
The %printer%%PNAME% is taken from the documentation to give the desired target printer. To stay with the example printer it will resolve to C364PS
gs is then called as
gswin32c -dNOPAUSE -dBATCH -r84 setup.ps <name of desired ps file here>
This works as expected, regarding the printed result. But I want a silent printout, since I have chosen the printer before. Whatever I choose for %PNAME%, it will always pop up the "select printer" dialog.
I am running Windows 8.1 and tried gs 8.70 and 9.19.
If I add /QueryUser 3 to the setup.ps, the printout starts without further confirmation of the printer, but then it will only print on the default printer, not on the one selected in the /OutputFile.
What am I missing?
Update: I have checked this question's result, but it does not work for me, dialog keeps popping up: https://superuser.com/questions/807027/how-to-print-with-ghostscript-in-silent-mode
Update 2: I have now (as requested) tried a commandline, with the same result. I also tried without the %printer%, no difference here:
gswin32c -dNOPAUSE -dBATCH -dNOPROMPT -dNOQUERY -sOutputFile="%printer%C364SeriesPCL" -r84 setup.ps 151008172940#123#000001#000001#PR_CCCC_Vertragspruef_4#CCCC_CAAA.358636.ps
setup.ps is this, no linebreaks have been added:
mark /NoCancel true /BitsPerPixel 4 /OutputFile (C364SeriesPCL) /UserSettings <</DocumentName (151008172940#123#000001#000001#PR_CCCC_Vertragspruef_4#CCCC_CAAA.358636) >> (mswinpr2) finddevice putdeviceprops setdevice
Solution:
The string %printer% is actually a literal in the setup.ps /OutputFile () or on the commandline. So changing the setup.ps worked:
mark /NoCancel true
/BitsPerPixel 4
/OutputFile (%printer%C364SeriesPCL)
/UserSettings <<
/DocumentName (151008172940TBS000001000001PR_CONT_Vertragspruef_4CONT_CONT.358636)
>>
(mswinpr2)
finddevice
putdeviceprops
setdevice
This way, the printer is found. I tried to copy the behavior with a commandline switch -sOutputFile but was not able to make the dialog go away without the setup.ps - I tried %%printer%%, but to no avail. As I am fine with the setup.ps, I am not following that further.
The root of my problem was, that the ghostscript documentation is correct, nevertheless, easily misunderstood here. Especially in the context of windows, it would not hurt to state explicitely, that %printer% is actually no env-variable, but really a string literal, that must be present in the output filename.
-sOutputFile="%printer%printer_name"
Specifies which printer should be used. The printer_name should be typed exactly as it appears in the Printers control panel, including
spaces.
To really answer my initial question. The commandline script must be changed, to escape the % signs in the %printer% literal:
echo mark /NoCancel true /BitsPerPixel 4 /OutputFile (%%printer%%%PNAME%) /UserSettings ^<^</DocumentName (%MYDOCNAME%) ^>^> (mswinpr2) finddevice putdeviceprops setdevice>setup.ps
gswin32c -dNOPAUSE -dBATCH -dNOPROMPT -r84 setup.ps %1
This works as initially planned.
I've moved this to an answer, because there is insufficient room in the comments.
So, what I would normally expect to see as a (simple) command line for this would be:
gswin32c -dNOPAUSE -dBATCH -dNOPROMPT -dNOQUERY -sOutputFile="%printer%C364SeriesPCL" 151008172940#123#000001#000001#PR_CCCC_Vertragspruef_4#CCCC_CAAA.358636.ps
Your command line includes -r84 which would normally set the resolution to 84 dpi, if that actually gets honoured you are going to print a horribly low resolution image of the PostScript, I very much doubt you really want that.
On top of that, you also are still sending setup.ps before your actual PostScript program. The problem with that is that setup.ps overrides the values you set on the command line. So your -sOutputFile="%printer%C364SeriesPCL" is overridden by the contents of setup.ps where you define /OutputFile (C364SeriesPCL)
Now, as I was suggesting earlier, your problem here is that the correct syntax for a printer is "%printer%printer name" and what you have in setup.ps is lacking the %printer%. I would imagine the reason that %printer% is missing is because you put it in a batch file and %printer% is being treated as an environment variable. Since it isn't set, it gets replaced by nothing.
So, I would suggest that you start off by using the command line you gave, but NOT including setup.ps and see what that does. If that works, then you know what the problem is. In order to use %printer% in a batch file you need to 'escape' the '%' which means you will need (I think) %%printer%%
Given that you have a PostScript printer (C364SeriesPS) why don't you just send the original PostScript file ? What you are doing here is having Ghostscript render the PostScript to an image (a Windows Bitmap in fact) which it then passes to the printing system, which will send the bitmap to the printer. This is slow, and involves shuffling a lot of data around, when you could just send the PostScript straight to the printer.

Ghostscript and pxlcolor: how to generate additional PJL entries in generated PCL

I have to set the Outbin in a PCL file that is generated via Ghostscript with the device=pxlcolor. I'm looking araund but didn't find the necessary parameter.
Can someone pls advice?
My commandline on windows is:
C:/Programme/gs/gs9.06/bin/gswin32c.exe -dBATCH -sDEVICE=pxlcolor -dFIXEDMEDIA -dMediaPosition=4 -dDuplex=true -sOutputFile=output.pcl -f Input.pdf
That produces a pcl file that takes it sheet(s) from the correct input tray/PaperSource.
There is no provision for this, you will have to add these manually after the file is generated.

Resources