GhostScript on CentOS 5.3 - Unable to process JPXDecode data - ghostscript

I'm trying to get our server to convert PDFs to image files. It's a CentOS 5.3 system and the latest version of ghostscript that can be (8.70), has been installed.
When I try to convert a PDF I get the following error repeated for each page, and the result is a load of blank images.
**** ERROR: Unable to process JPXDecode data. Page will be missing data.
So, I found an answer on here that seemed to answer that question:
iText PDF; howto convert jpeg2000 to jpg using Java
Following that I downloaded iText 5.3.4 and jai_imageio-1.1.jar and compiled the supplied script on my local machine. When I run the final conversion command on my PDF I get:
java.lang.NullPointerException
at com.itextpdf.text.pdf.parser.PdfImageObject.decodeImageBytes(PdfImageObject.java:296)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:199)
at com.itextpdf.text.pdf.parser.PdfImageObject.<init>(PdfImageObject.java:158)
at PDFConverter.hasJpeg2000(PDFConverter.java:36)
at PDFConverter.main(PDFConverter.java:15)
Doesn't contain any JPEG2000 images: Nothing to be done...
I'm not sure whether that's definitely saying that the PDF doesn't have any JPEG2000 images, or whether I've done something wrong when I compiled the script. Perhaps I've got the wrong version of iText since no links were provided in the answer to that other question.
So now I either need help to convert my PDFs to remove any JPEG2000 images, or I need help to get our server running ghostscript properly.

Related

containerd - image might be filtered out message

I have 2 machines one is connected to the internet and the other one is not. Whenever I need to get any container image in the offline machine, in the online machine I am pulling the image by docker then save it as a tar then I take this tar file and import it in the offline machine.
The online machine has docker engine but the offline machine has Containerd. Last time when I pulled this image and tried to import it, I am getting "image might be filtered out" error message.
ctr images import quay.ubuntu.22.04.tar
ctr: image might be filtered out
I didn't find much details on this error message but as per this thread the issue maybe due to mismatch between the architecture used for the image and the one for the machine, but I am not able to know the architecture used for the image .. how can I check that !
If anyone faced the same issue before and has any idea how to get rid of it, it would be really helpful.
I am using containerd-1.6.8-linux-amd64.
I downgraded the containerd I am using from v1.6.8 to v1.6.6 and I faced the same problem but when I downgraded to v1.5.13 the image imported but still I am getting below message.
ctr images import /vms/quay.ubuntu.22.04.tar
unpacking quay.io/containerdisks/ubuntu:22.04 (sha256:be5e9b2b413ee416c125b39d3b28f719d1c484c0384475ab890122150be67061)...ctr: content digest sha256:f00d98d62674e83365d5b09b4007a7e346f9dc993f7e67976f63cec65ca22325: not found
The issue was in pulling the image with docker, save it as a tar, then importing it with ctr in docker. simply, Pulling it with docker or so, ended with an error.
I solve it by using 'ctr/containerd' in the whole process pulling, saving and importing the image.
Kind did not use --all-platforms flag by default. That was changed by below PR. Running brew upgrade kind fixed it for me
kind --version
kind version 0.17.0
See kind issue #2957 and other SO thread.

combine_pdf gem : PDF is Encrypted! Attempting to decrypt - not yet fully supported

Trying to merge PDF file
I'm using version (1.0.16) and tried (1.0.21) also, but still getting this error PDF is Encrypted! Attempting to decrypt - not yet fully supported.
I'm able to open the file in preview without password.
I see this issue, which is already discussed issue#66 and closed but still getting error, any help here?
https://github.com/boazsegev/combine_pdf/issues/196

How to convert PDF version to 1.7 ExtensionLevel 8 using Ghostscript

I am able to convert the PDF version from 1.5 to 1.7 with the below Ghostscript code but how to convert "PDF version 1.7 ExtensionLevel 8"?
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dFastWebView=true -dCompatibilityLevel=1.7 -sOutputFile=output.pdf input.pdf
What exactly are you expecting to happen here ?
Your command line doesn't actually do anything except write a different version number into the PDF header. The same would be true of writing an extension version, all it does is change the 'version', it doesn't affect the content of the PDF file.
Ghostscript's pdfwrite device doesn't even use the features of PDF 1.5 (with a couple of minor exceptions), so what do you expect to gain even by producing a PDF 1.7 file ?
Lying about the minimum required version (which is what you are doing when you change the version like this) simply means that older PDF consumers might fail to open the file (or give a warning) because they believe it will use features which they don't support. Since the PDF file doesn't use those features, you are actually making the file less portable by doing this.
FWIW Ghostscript's pdfwrite device can now produce PDF 2.0 files.
If you absolutely are insistent about doing this you can 'probably' add an Extensions dictionary to the document Catalog using pdfmarks, but I'm not 100% confident.

wkhtmltopdf with silverstripe 3.2

I'm playing around with pdf generation. After the silverstripe modules for dompdf and tcppdf which doesn't work like I want them to, I came across BetterBrief's module for wkhtmltopdf https://github.com/BetterBrief/silverstripe-pdf
It should be exactly what I need but I can't figure out why it's not creating pdfs. I installed it with composer following the module instructions, after that I installed the debian application and set up a demo template with just three words in it to test ist. But the pdf file can't be created.
The error I receive is the following and not very helpful to me http://www.sspaste.com/paste/show/5676bac4a4186
perhapse someone had the same problem or knows a solution for that.
the creation of a pdf from commandline works
wkhtmltopdf http://google.com google.pdf
Edit That's not a real solution for this problem, but an alternativ to create a pdf with SilverStripe and wkhtmltopdf. https://github.com/creativeSynergy/silverstripe-wkhtmltopdf
A quick google shows it has something to do with wkhtmltopdf needing X to work.
https://github.com/knplabs/snappy/issues/20

Count pages in PCL with GhostPDL 9.x

I used to Count pages in a pcl file using the GhostPDL (pcl6.exe) in Version 8.71.
pcl6.exe -dNOPAUSE -sDEVICE=nullpage -g10x10 -C file.prn
which produced a
%%PageCount: 10
for instance. Now I updated to 9.10 Version and found that my usual code did not work anymore. The command line Switch "-C" is gone.
I searched the documentation but it brought me nowwhere close to a solution. So it does not seems a very good approach to convert PCL to PDF and then count the PDF pages with GhostScript.
Any suggestions?
Why is converting to a PDF and then using pdfinfo not a good solution ?

Resources