When I use the lib and code outlined below to turn a HEIC to a PDF. I notice that there are two images in the resulting pdf. A large one and a smaller one.
I also notice that if I send the same files to an online HEIC to PDF convertor, the resulting PDF only has one image.
Is Aspose purprosely putting two images there or is this a bug?
Attaching the HEIC and the resulting PDF.
template.zip (4.4 MB)
Note I’m building a .net 4.8 app and using the .net 4.0 libs for aspose.image, and the .net 20 standard for the openize binaries.
Hi @danwise ,
Well, in fact it was purposely, but now I see that this needs to be changed.
The idea was to give access by default to all non-hidden frames of the image. And the thumbnail, as it turned out, is not hidden.
It was done in this was as some HEIC images actually contain more than one image. We will rethink the approach in the next HEIC update.
For now I can suggest you to change a bit the code, that you are using.
using Aspose.Imaging.HEIC.Adapter;
using Aspose.Imaging.ImageOptions;
HEICImage.Register();
using var image = Aspose.Imaging.Image.Load("example.heic");
var defaultPage = ((IMultipageImage)image).Pages[0];
defaultPage.Save("MyFile.pdf", new PdfOptions());
The 0 page is always the default page that is coded in file. As long as the file contains only one image, that will work for you.
Ah interesting. Yes ok this is excellent information
Hi @danwise
You can update Openize.Heic (it is a dependency for adapter) to 25.8.0 and there will be no thumbnails in the output with the code from documentation.
using Aspose.Imaging.ImageOptions;
using Aspose.Imaging.HEIC.Adapter;
HEICImage.Register();
using (var image = Aspose.Imaging.Image.Load("source.heic"))
{
image.Save(Path.Combine(outputDirectory, "output.pdf"), new PdfOptions());
}