Unable to detect blank pages in PDF document excluding header and footer

static private bool IsBlankPage(Aspose.Pdf.Page page)

{

    if ((page.Contents.Count == 0 && page.Annotations.Count == 0) || HasOnlyWhiteImages(page))

        return true;

    return false;

}

static private bool HasOnlyWhiteImages(Aspose.Pdf.Page page)
{
    // return true if no images exist or all images are white
    if (page.Resources.Images.Count == 0)
    return true;
    foreach (XImage image in page.Resources.Images)
    if (!IsWhiteImage(image))
    return false;
    return true;
}

static private bool IsWhiteImage(XImage image)
{
    MemoryStream ms = new MemoryStream();
    image.Save(ms);
    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(ms);
    for (int j = 0; j < bmp.Height; j++)
        for (int i = 0; i < bmp.Width; i++)
        {
            System.Drawing.Color color = bmp.GetPixel(i, j);
            if (color.R != 255 || color.G != 255 || color.B != 255)
                return false;
        }
    return true;
}

@saraprak000

Could you please share the sample PDF document as well so that we can test the scenario in our environment and address it accordingly.

Here is the sample document redacted due sensitive information. If you look at page 10 you could see the blank page with header and footer information. Thank you for looking into it.

Sample Document_Aspose.pdf (573.6 KB)

@saraprak000

We were able to replicate the scenario at our side with Aspose.PDF for .NET 20.12 and have logged it as PDFNET-49234 in our issue tracking system for the sake of investigation. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thanks for update. Will looking forward to your rectification.

1 Like

This is to follow up on issue PDFNET-49234 with who ever is working on this issue. Any update would be appreciated. Thank You!

@saraprak000

The ticket has recently been logged in our issue tracking system and will be resolved on a first come first serve basis. We are afraid that it is not yet investigated. We will surely provide an update in this forum thread as soon as we have some regarding fix of the issue. Please give us some time.

We apologize for the inconvenience.

It has been more than a month we have reported this issue. Do you have any ETA on this issue? Thanks!

@saraprak000

We are afraid that the issue could not be resolved due to other issues in the queue logged prior to it. However, we will surely post in this forum thread as soon as we make some definite progress towards the resolution of the ticket. Please give us some time.

We are sorry for the inconvenience.

I would like to follow up on this issue. Is there any update on this issue? Thanks!

@saraprak000

We regret to inform you that the earlier logged issue is not yet resolved. As soon as its investigation is completed, we will share updates with you. We highly appreciate your patience and comprehension in this matter. Please spare us some time.

We apologize for the inconvenience.