Generate Pdf from Heic Image

I have tested to create a pdf file from a heic image file. I tested this code example “Convert HEIC to PDF via C# | products.aspose.com” but this throws a NullReferenceException when calling Aspose.Imaging.Image.Load(heicFile). I used a console app with .Net 6.0 and 8.0 and the newest nuget packages for Aspose.Pdf (24.9.0) and Aspose.Imaging.Heic.Adapter (

My code was this:
using Aspose.Imaging.HEIC.Adapter;
using Aspose.Imaging.ImageOptions;
using Aspose.Pdf;

namespace AsposeWordTest
{
internal class AposePdf
{
public void ConvertHeicToPdf()
{
var heicFile = @“c:\users\xx\downloads\20220228_212000.heic”;

        HEICImage.Register();
        // the next line throws a NullReferenceException
        using (var image = Aspose.Imaging.Image.Load(heicFile))
        {
            // Save image to pdf
            image.Save(@"C:\Users\xx\Downloads\asposeTest\outputHeic.pdf", new PdfOptions());
        }
    }
}

}

I have updated again nuget packages. Now the code runs without exception, but it always shows that the pdf is created without licence. How do I have to include my Aspose.Total licence? Please update your example code.

@bruns Hello!

Can you please provide the original heic file where the error occurs when being processed?

Sorry, I cannot share the file I have used for testing, because it contains employee information. I will ask for another file.

But did you read my last update. I did my first test some weeks ago, last week I did the test again and now it runs, but I still have a licence problem. The resulting pdf shows “Evaluation only. Created with Aspose.Imaging…”. I do not know how to include my licence file. I have Aspose.Total.

Oh, sorry, I have read the post before that update.
No need for another file if the NullReferenceException is gone.

Please try the following code before reading heic file:

Aspose.Imaging.License license = new Aspose.Imaging.License();
license.SetLicense(“Aspose.Total.lic”);
// here goes the path to the license file

Details about license file usage can be found here: