Alternatives to ImageMagick for PDF downsizing
Having an issue with some PDF files not dis开发者_运维问答playing properly in our iPad app. I have come to the conclusion that we are needing to standardize by "converting" PDF to PDF. I have successfully processed this using ImageMagick to convert the PDF to PNG (resized), and then pushing the PNG(s) back into a PDF. However, something within ImageMagick is making photos within PDFs display wrong. Same issue just converting a JPG or other graphic to PDF in ImageMagick. I solved that by taking the output of the converted ImageMagick file and converting it again using GD to PNG, then pushing it through our PDF converter.
So my question is this: What other PHP workflows would work with this, other than using ImageMagick for the conversion back to PDF? We are not opposed to a paid solution, we just need something that works. Our server runs centOS.
My gut instinct, other than yelling at whoever wrote the PDF reader that you're suffering with, would be to convert the PDF to PostScript using pdftops, then convert it back into a PDF using Ghostscript. You can enable a number of document compatibility options at that point, which may make it more digestible.
While this may have side effects, they should be minimal. PDFs are basically a wrapper around a PostScript document, and it looks like pdftops can not do utterly stupid things during the conversion process.
This may break or simply not work with advanced PDF features, like digital signatures or forms.
精彩评论