Preserving transparency when converting PDFs

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
magickmania

Preserving transparency when converting PDFs

Post by magickmania »

Hello,

I am trying to preserve transparency within my PDF during the convert process. My original PDF has a transparent background, when I resize and convert to another file, the resized area within the new PDF is transparent, however, the transparent areas within the original PDF becomes white.

The command I am using to do the conversion/resize is:
convert -size 1366x736 -resize "683x368>" -density 300 -background none -gravity center -extent 683x368 sample2.pdf sample_resized.pdf

where sample2.pdf is the original file, and sample_resized.pdf is the resized file. I have also tried converting the original pdf to a png (changed the -sDEVICE to pngalpha in the delegates.xml file) and then converted from png to pdf, but that didn't work.
The original file is posted here: http://app01.brandconstructionkit.com/tmp/sample2.pdf

Any suggestions would be greatly appreciated.

Thank You.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Preserving transparency when converting PDFs

Post by anthony »

See A word about Vector Image formats
http://www.imagemagick.org/Usage/formats/#vector
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
magickmania

Re: Preserving transparency when converting PDFs

Post by magickmania »

Anthony, thank you for that link. Basically, conversion from one vector to another vector image (in this case, PDF to PDF) will yield unacceptable results when using Image Magick. What if I converted the transparent PDF to a PNG, and then used that PNG to re-convert back to PDF, would that preserve the transparency from the original PDF?

Also, if it was possible to maintain transparency when converting from PDF to PNG, what parameters do I need to add to this command to do that sort of a conversion:

convert -size 1366x736 -resize "683x368>" -density 300 -background none -gravity center -extent 683x368 sample.pdf sample_resized.pdf

Again, any help would be greatly appreciated.

Thank You!
Post Reply