Magick.NET
Magick.NET copied to clipboard
PDF/A compatibility
Magick.NET version
14.0.0
Environment (Operating system, version and so on)
Windows (but .Net 8 app)
Description
I am saving image in MagickFormat.Pdfa format. However online validators show that result pdf is not valid.
I am using this site to validate pdf results: https://xodo.com/validate-pdfa
Steps to Reproduce
Convert image to pdf by setting magickFormat.Pdfa
Simplified code:
// Loading image and adding to collection
var magickReadSettings = new MagickReadSettings();
using var image = new MagickImage("Path_to_file", magickReadSettings);
using var imagesCollection = new MagickImageCollection();
imagesCollection.Add(new MagickImage(image));
// Saving to PDF.
using var fileStream = File.Create(outputFile);
var magickFormat =MagickFormat.Pdfa; // Setting format PDF/A
imagesCollection.Write(fileStream, magickFormat);
Images
Validation results:
Thanks for reporting this. But where can I find Path_to_file so I can reproduce this and figure out what is happening exactly.
Hello @dlemstra Path_to_file is image location in computer's file system. Image is saved in my computer and I load it by passing it's path to magick.
Path_to_file example value: "D:\Code\SampleProject\SampleProject.Converter.Image\SampleProject.Converter.Image.Tests\bin\Debug\net8.0\Files\test1.jpg"
What I meant and should have made more clear is that I need your image to reproduce the issue. Maybe there is something in your file that causes this to break.
Oh understood,
Here is the image:
But I tried several images, non of them were compatible after conversion.
I can understand it might happen for multiple images but I just want to make sure I can reproduce the issue.
That website did not give me a lot of info but I got a bit more information. The document contains three errors were one was easy to fix. But for the other two I only got the following information from another site:
ISO 19005-3:2012 section 6.2.4.3
DeviceRGB shall only be used if a device independent DefaultRGB colour space has been set when the DeviceRGB colour space is used, or if the file has a PDF/A OutputIntent that contains an RGB destination profile.
ISO 19005-3:2012 section 6.1.3
The file trailer dictionary shall contain the ID keyword whose value shall be File Identifiers as defined in ISO 32000-1:2008, 14.4
I need to pay to get access to the ISO 19005-3:2012 document and that is not going to happen. So I will need more details from someone else before I will be able to fix these issues.
I found the ISO 32000-1:2008, 14.4 information so I can also fix the second problem mentioned above. But I could use some help to find more information about the first problem mentioned above.
Hi @dlemstra,
Thank you for investigating the issue. If I understand correctly, have you already resolved 2/3 problems, and does fixing the remaining one require purchasing documentation? If so, could you clarify exactly where that documents needs to be bought? Feel free to send the details to [email protected].
Thanks again!
I don't know if getting the document will give me enough information to figure out what we need to do. I did some experimentation yesterday and asked AI's about getting more information. And the advice that I kept getting was that with a PDFA document it would be good to add a color profile instead of using "Default/DeviceRGB". So that could be something that you could do resolve the remaining issue. I tried to see if we could not include the colorspace in the document but it looks like that would require a complete rewrite that will probably take a long time to do. And then I don't even know if that is going to resolve the issue that was mentioned by that analyzer.
Hi @dlemstra, sorry for the delay.
Alright I will try to play around with color profile. Could you please let me know in which version are you planning to release those 2/3 improvements?
Those fixes will become available in the next release. I will add the milestone here.