new pdf:version option

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Locked
Kolapsrebel
Posts: 5
Joined: 2019-10-30T08:04:04-07:00
Authentication code: 1152

new pdf:version option

Post by Kolapsrebel »

Hi there,
I saw that you've recently added an option in 7.0.10-1 to specify the pdf:version to use in output of a conversion.
I'm very interested as I need to provide pdf v1.4 to my printer, so I've tried a bit around this option, running on Version: ImageMagick 7.0.10-2 Q16 x86_64 2020-03-22.
However it doesn't seems to work every time.

I have two different jpg images that I convert to pdf with command :

Code: Select all

magick -density 300 -define pdf:version=1.4 <NAME>.jpg <NAME>.pdf
nature.jpg is converted to pdf 1.4, but isola.jpg is converted to pdf 1.7

The truth is that I first have a pdf : isola.pdf (wich is in v1.4) that I want to flatten (in order to convert the vector font to image) into another pdf v1.4.
but the direct command from pdf to pdf generates a pdf v1.7 even if I specify -define pdf:version=1.4 :

Code: Select all

magick -density 300 -define pdf:version=1.4 isola.pdf isola-flatten.pdf
So, as I saw that converting to pdf v1.4 from jpeg works with nature.jpg. I tried to first flatten my isola.pdf into isola.jpg, then convert isola.jpg to pdf v1.4, but the conversion still generate a pdf v1.7

Here are links to source files :
https://filedn.com/lNzoun7fVjYBhVzayKa4vy5/nature.jpg
https://filedn.com/lNzoun7fVjYBhVzayKa4vy5/isola.jpg
https://filedn.com/lNzoun7fVjYBhVzayKa4vy5/isola.pdf

Thanks.

User avatar
dlemstra
Posts: 1625
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: new pdf:version option

Post by dlemstra »

That option can only be used to "upgrade" the version and not to choose a lower one than required. Your image contains a color profile and that is why it is upgraded to version 1.7. Maybe we could change our code to ignore the color profile if a lower version is provided but we will need to investigate that.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: new pdf:version option

Post by magick »

Try this command:

Code: Select all

magick -density 300 isola.pdf -strip -define pdf:version=1.4 isola-flatten.pdf

Kolapsrebel
Posts: 5
Joined: 2019-10-30T08:04:04-07:00
Authentication code: 1152

Re: new pdf:version option [resolved]

Post by Kolapsrebel »

Thanks for you answers.
Stripping the metadata before generating the pdf works and generate a pdf v1.4 that seems to be correct.
I'll now dig into the impact of stripping this embeded color profile, but that's another subject.
Thanks. :)

Locked