'Object reference not set to an instance of an object.' while converting page to PNG

Dear support,
I’m using Aspose.PDF to get thumbnail of first page of some pdf files with below code, but error occurred:
“Object reference not set to an instance of an object”

using (var ms = new MemoryStream(File.ReadAllBytes(@“D:\Beginning Microsoft SQL Server 2012 Programming.pdf”)))
{
var pdf = new Document(ms);
var mso = pdf.ConvertPageToPNGMemoryStream(pdf.Pages[1]);
File.WriteAllBytes(@“D:\Beginning Microsoft SQL Server 2012 Programming.pdf.png”, mso.ToArray());
}


Stack Trace:
at #=zUCCFEnc8iGlSEATxRvUz6XuQYphwTZyXRAgWRKP9wuNT.#=zMoUFucUnkZ2S(#=zMpjOs7VDXIsCbHv8UdtR4Z_sSQ82Ath1HQ== #=zfvoEoF8=, #=zK0Zae2nT9grrdestLRwNBCgRmpsSL8R2ORSIRuKbDFtA #=zmrHx47E=, #=zZINVwcFDY7TE1hiyb97c7HX$$vd9UIckWw== #=z3ObmjWQZ_2mF)
at #=zUCCFEnc8iGlSEATxRvUz6XuQYphwTZyXRAgWRKP9wuNT.#=z1S1kheEOQ7Sy(#=zMpjOs7VDXIsCbHv8UdtR4Z_sSQ82Ath1HQ== #=zfvoEoF8=, #=zK0Zae2nT9grrdestLRwNBCgRmpsSL8R2ORSIRuKbDFtA #=zmrHx47E=)
at #=zUCCFEnc8iGlSEATxRvUz6XuQYphwTZyXRAgWRKP9wuNT.#=zK7XUQHA=(#=zscDifpOod22ZYH6qMuyxduz5bGkL #=z4E3QaJI=, #=zMpjOs7VDXIsCbHv8UdtR4Z_sSQ82Ath1HQ== #=zfvoEoF8=, #=z63qwDDCy8HEFsxbAMBNU3QSn4LfVZKFLeDUiKCY= #=zllCT5Zg=, #=zK0Zae2nT9grrdestLRwNBCgRmpsSL8R2ORSIRuKbDFtA& #=zmrHx47E=)
at #=zPVWVjCyah_TMHUWViTXz62LTIxew.#=zhBRLJYE=(#=zK0Zae2nT9grrdestLRwNBCgRmpsSL8R2ORSIRuKbDFtA& #=zmrHx47E=)
at Aspose.Pdf.Devices.ImageDevice.#=zhBRLJYE=(Page #=zfvoEoF8=)
at Aspose.Pdf.Devices.PngDevice.Process(Page page, Stream output)
at Aspose.Pdf.Facades.PdfConverter.#=zchpYpsNHqlJd4fk2Nw==(Page #=zfvoEoF8=)
at ConsoleApp1.PdfUtilities.TakeSnapshot(Document pdf) in C:\Users\milad\source\repos\ConsoleApp1\ConsoleApp1\PdfUtilities.cs:line 54
at ConsoleApp1.Program.Main(String[] args) in C:\Users\milad\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 33


Sample PDF file.

Thank you and best regards
Milad Ashrafi

@milad.ashrafi

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-46076 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

We are sorry for the inconvenience.

1 Like

The issues you have found earlier (filed as PDFNET-46076) have been fixed in Aspose.PDF for .NET 19.7.