I created a virtual printer with the "Multi File Port Monitor" software and this virtual printer call the following Ghostscript:
"C:\GS\[version]\bin\gswin64c.exe" -r204 -dMinFeatureSize=1 -dInterpolateControl=-1 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -dAlignToPixels=1 -dNOINTERPOLATE -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dDownScaleFactor=1 -sOutputFile="%f" -
The script creates an output file and it's ok, but I need to save the original file too.
What's the best way to do this?
Related
im trying to create a barrier-free pdf-document with Ghostscript (Version 9.54)
In the end i need a pdf file which contains tags in it.
I was trying to use the following command, but it didn't work.
gsprint.exe -ghostscript "C:\Program Files (x86)\GS\bin\gswin32c.exe" -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dQUIET -dPDFA=2 -dCompatibilityLevel=1.4 -sPDFACompatibilityPolicy=2 -dNOOUTERSAVE -dProcessColorModel=/DeviceRGB -sOutputFile=""C:\temp\ghost\pdfua.pdf"" ""C:\temp\test23.pdf""
Ghostscript creates a new pdf in the specified folder (c:\temp\ghost\pdfua.pdf) but there are no tags in it.
Have you guys some ideas?
thx
I am trying to convert a .pdf file to .pcl using Ghostscript v.9.53.3. This is the command I run from the Cmp Prompt:
gswin64.exe -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pxlcolor -soutputFile=C:\PCLprocessed\input.pdf output.pcl
However, I get the following error:
"GPL Ghostscript 9.53.3:Device pxlcolor requires an output file but no file was specified.
***Unable to open the initial device, quitting"
Also, when i try to run the following command, this error appears:
gswin64.exe -dNOPAUSE -dBATCH -sDEVICE=ps2write -dSAFER -dAutoRotatePages=/NONE -sPAPERSIZE=a4 -sOutputFile=C:\PDFtoprocess*.pdf C:\PCLprocessed*.pcl
"Undescoverable error: rangecheck in .putdevicecrops"
Can anyone explain why I get these error messages? I'm totally new to Ghostscript and i' m just trying to make this work for a job project.
Thanks in advance
How can I read the files contained in the directory d:\ with batchscript not one by one files like that. I have tried the following:
#echo off
"C:\Program Files\gs\gs9.25\bin\gswin32c.exe" -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/printer -dColorImageResolution=90 -dAutoRotatePages=/None -dBATCH -dNOPAUSE -sOutputFile=d:\d\koran.pdf *d:\a\01.pdf d:\a\02.pdf d:\a\03.pdf d:\a\04.pdf d:\a\05.pdf d:\a\06.pdf d:\a\07.pdf d:\a\08.pdf d:\a\09.pdf d:\a\10.pdf d:\a\11.pdf d:\a\12.pdf d:\a\13.pdf d:\a\14.pdf d:\a\15.pdf d:\a\16.pdf d:\a\17.pdf d:\a\18.pdf d:\a\19.pdf d:\a\20.pdf d:\a\21.pdf d:\a\22.pdf d:\a\23.pdf d:\a\24.pdf*
exit
Ghostscript doesn't 'merge' PDF files. It creates new PDF files by interpreting the contents of its input, this is not the same thing. You should read the documentation here
You haven't said what the problem is with the command you have tried, its going to be hard to help you if you don't do that.
The most likely problem is that you have put * characters at the start and end of the input filenames. Ghostscript itself doesn't match wildcards, it expects you to tell it each file you want to process individually. So in order to process a directory of files is to first get a list of all the files, and then tell Ghostscritp to use each of those files in turn.
You can use the Ghostscript #filename syntax (documented here)to tell Ghostscript to use the contents of a file as if it were the command line.
So all you need to do is come up with a shell script which will write the filenames from a folder into a file. That's not a Ghostscript question, and depends totally on the operating system you are using.
For Windows something like:
dir /B *.pdf >> files.txt
gswin32c -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile=\temp\out.pdf #files.txt
del files.txt
might be sufficient for your needs.
I could not make it work using "files.txt" but I am using this and everything works just fine.
gswin64c -sDEVICE=pdfwrite -dBATCH -dNOPAUSE -sOutputFile="out.pdf" (Get-ChildItem -Path .\*.pdf)
You can execute like below:
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=merged.pdf *.pdf
Reference:
https://gist.github.com/moaazsidat/b94185e9cfdba9e3cfb5bc90407e6397
My problem is not with Ghostscript, its works fine.
The problem is that when I try to print, Ghostscipt process call to Print Driver and a confirmation is needed.
I have to print without box print dialog, similar to called Quick Print on Office package.
My print model is HP Professional P1102, Operative System W7, printer is connected from USB.
I am using next command on Windows cmd:
gswin64.exe -dNOSAFER -dNOPAUSE -dBATCH -dNOPROMPT -sDEVICE=mswinpr2 -sOutputFile="\\spool" "\\pdf_name.pdf"
Somebody have suggestions?
Thanks for all
gswin64.exe -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 -sDEVICE=mswinpr2 -sOutputFile="\\\\spool\printername" "C:\pdf_name.pdf"
I tried this and it works without any prompt.
The printer name is after the \\spool\ string.
Trying to merge all pdfs in a directory using GhostScript 9.06 64bit in a .bat file
The following, makes merged.pdf, but it is 1 page and blank
call gswin64c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf *.pdf
If I actually specify which PDFs to merge it works fine. What gives?
call gswin64c -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf 1.pdf 2.pdf 3.pdf
You can't specify wildcards on the Ghostscript command line, simple as that.
Since GS didn't find a file called '*.pdf' it didn't execute any marking operations, in this case you get a blank file.
Ghostscript cannot do wildcard expansions by itself.
If you call gs ... *.pdf from inside a shell which can do wildcard expansion, it will work nevertheless.
There is a difference with the site you linked to and the code you used above:
Your code is DOS batch and uses call gswin64c .... But as said, Ghostscript cannnot expand wildcards itself.
The code in the linked web page is Unix shell, which does the wildcard expansion before Ghostscript gets to see its own commandline. When Ghostscript gets to see it, the wildcard expansion has happened already.
You have to find a solution for your batch file where you first store your (expanded) *.pdf file names in a variable %mypdfs% and then do call gswin64c ... %mypdfs%.
you can't specify the wildcard from the command line, but you can make gswin32c run a command file.
as the 'command file' just requires switches to be separated by any amount of white space (space, tab, line break), and there is no limit on the size of the file, we can make a file that does what you need
echo -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf > files.gsx
dir *.pdf /b >> files.gsx
once this file files.gsx has been created, then you can make your file using
gswin32c #files.gsx
and all the files will be merged
I did the following to solve this:
1.) dir /B *.pdf > do.bat
2.) opened do.bat with notepad to replace \r\n with spaces
3.) inserted: c:\Programs\gs\gs9.07\bin\gswin64 -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=merged.pdf at the beginning
and then executed do.bat
VoilĂ