Aspose.PDF loading invalid documents resulting in program crashing

Hi team,

I have an issue with Aspose PDF (version 20.6.0.0) .NET Core version under Linux when Aspose PDF loads invalid documents, it returns a Document object with one page and that page is null. When I check if the page is null (seems causing Aspose.PDF to load the page), the program crashes.

My sample code:
Aspose.Pdf.Document document = new Aspose.Pdf.Document(inputFile);
if(document.Pages[1] != null) // the program crashes here
{ }

Here is the sample file sample.zip (1.4 KB)

Could you please help investigate and fix the issue?

Thanks.

@dunghnguyen

I request you to explain that do you want to check if the page is blank or if you want to check if there is any page in the PDF document?

Hi @mudassir.fayyaz,

Thank you for checking this issue.
I would like to check if the page is blank.

Regards

@dunghnguyen

You can check blank page of a PDF with the following code:

Document pdfDocument = new Document(dataDir + "Before.pdf");
foreach(Page page in pdfDocument.Pages)
{
    Console.WriteLine(page.Number + " is blank = " + page.IsBlank(0.01d));
}