Create accessible PDF Files with Ghostscript - pdf

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

Related

GhostScript save the original file too

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?

Error in converting a .pdf file to .pcl via Ghostscript 9.53.3

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 to merge all PDF's in a directory with ghostscript

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

Converting PDF to PCL via Ghostscript only without colour?

We are trying to convert some PDF files into PCL files using Ghostscript.
The commandline we're using:
gswin32c -dBATCH -dNOPAUSE -sDEVICE=pxlcolor \
-f ..\examples\pu.pdf -sOutputFile=..\examples\pu.pcl
This generates a black&white PCL file.
Please help, what's wrong?

GhostScript removes images from some processed PDF files

I'm using this command with gs 9.01:
gs -q -dAutoRotatePages=/None -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -sOutputFile=out.pdf in.pdf in.pdfmarks
and on some processed files (out.pdf) I noticed that images are missing, although present in input file (in.pdf).
Why is this and how can I assure that images are retained after processing with gs?
1) Update to the current version, 9.04.
2) If you still experience problems, report a bug at http://bugs.ghostscript.com. You will need to attach a sample PDF file