Converting PDF to PCL via Ghostscript only without colour? - pdf

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?

Related

imagemagick FailedToExecuteCommand `"gswin64c.exe" when converting pdf

I am seeing the following error when converting a pdf into another pdf just as a test. This also happens when converting the pdf into any other file format
magick convert example.pdf test.pdf
convert: FailedToExecuteCommand `"gswin64c.exe" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -dPrinted=false "-sOutputFile=C:/Users/brand/AppData/Local/Temp/magick-MzUgEU_V-cMidHdNrWG2hR56GHegabIj%d" "-fC:/Users/brand/AppData/Local/Temp/magick-ip4WYomlHXJDe5oZnT8WnJ3S-c6NgSe2" "-fC:/Users/brand/AppData/Local/Temp/magick-U7oHzpaPP3SMSPujfBR1lS8_QXa3KII0"' (The system cannot find the file specified.
) # error/delegate.c/ExternalDelegateCommand/516.
convert: PDFDelegateFailed `The system cannot find the file specified.
' # error/pdf.c/ReadPDFImage/714.
convert: no images defined `test.pdf' # error/convert.c/ConvertImageCommand/3327.
I have installed imagemagick on windows.
Converting from .png or .jpg to .pdf seems to work but converting from .pdf to any other file format doesn't seem to work.
Installing GhostScript did the trick. Kudos to K J

why unable to compress scanned PDF in ghostscript?

In older version 8.70 it was working but I had updated the ghostscript version 9.27 and now it's not compression the scanned pdf files. Can we have any other solution to compress pdf on linux server?
Below command I am using for the pdf compression
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dDownsampleColorImages=true -dPrinted=true -dColorImageResolution=100 -dNOPAUSE -dBATCH -sOutputFile=output.pdf input.pdf
Sample file
https://easyupload.io/fe64dt

Create accessible PDF Files with Ghostscript

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

How to create a PDF/A from command line with Libre Office Draw in headless mode?

LibreOffice Draw allows you to open a non PDF/A file and export this a PDF/A-1b or PDF/A-2b file.
The same is possible from the command line by calling on macOS
/Applications/LibreOffice.app/Contents/MacOS/soffice --headless \
--convert-to pdf:draw_pdf_Export \
--outdir ./pdfout \
./input-non-pdfa.pdf
or an a Linux simply
libreoffice --headless \
--convert-to pdf:draw_pdf_Export \
--outdir ./pdfout \
./input-non-pdfa.pdf
On the command line it is possible to tell the convert-to to create a pdf and use LibreOffice Draw to do this by telling --convert-to pdf:draw_pdf_Export.
Is there also a way to tell LibreOffice to produce a PDF/A document in headless mode?
For PDF/A-1(means PDF/A-1b?):
soffice --headless --convert-to pdf:"writer_pdf_Export:SelectPdfVersion=1" --outdir outdir input.pdf
Change the value from 1 to 2 for PDF/A-2, here is the Libreoffice source code Common.xcs, pdfexport.cxx and pdffilter.cxx.
(Maybe outdated) API/Tutorials/PDF export - Apache OpenOffice Wiki
Python Guide - PDF export filter data - The Document Foundation Wiki
excel->pdf変換 command のdpi設定 - Ask LibreOffice
Change default resolution in batch PNG conversion [closed] - Ask LibreOffice
Since with LibreOffice is possibile only via GUI, for command line solution use gs
First convert pdf to ps
pdftops input.pdf input.ps
Then convert ps to pdf/a archival format of PDF
gs -dPDFA -dBATCH -dNOPAUSE -dNOOUTERSAVE -dUseCIEColor -sProcessColorModel=DeviceCMYK -sDEVICE=pdfwrite -sPDFACompatibilityPolicy=1 -sOutputFile=input-A.pdf input.ps

Remove PDF margins while using PDFFitPage in GhostScript

I'm fitting a file with no margins (produced using a pdfcrop from a normal PDF file) to a given paper size using GhostScript:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dFIXEDMEDIA \
-dPDFFitPage -d -dBATCH -dQUIET -dNOPAUSE -dDEVICEWIDTHPOINTS=864 \
-dDEVICEHEIGHTPOINTS=612 -sOutputFile=$INPUT $OUTPUT
but the output has additional margins (I was cropping in order to get rid of them).
Is it possible to force GhostScript to produce output without these margins?
Without seeing your file I cannot be certain, however I suspect that all you have done is set a /CropBox in the PDF file. By default Ghostscript uses the /MediaBox which is probably unchanged.
Try setting -dUseCropBox