We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to find a blank page in pdf document

We receive 100+ document via postal mail. Each paper document can have different number of pages. We put a blank paper as a separator sheet between these document and then we scan these documents to produce single large PDF document.

Once we receive this large PDF, We have automated process that needs to shred the large PDF by finding separator blank page and then create individual pdf.
In large PDF even though separator page looks like a blank page, technically its not a blank page. Since this is a scanned blank paper, the pdf page has single blank image. (Also depends on scanner quality the blank page may have some small black dots that we usually see on scanned document.)

In-fact all the pdf pages have a single large image, since they are scanned pages.

I can loop through all the pages and creates new pdf whenever i find separator page. The challenge here is to find separator page. In above scenario what would be a best option to find blank page?

On side note, We also tried using bar code page as separator sheet. However sometime the scanned quality of the barcode is so bad that aspose.barcode could not identify it as barcode. So we are now trying blank page as separator sheet.

@Laksh,

Loop through all the pages and use Page.IsBlank property to get the flag whether page is blank or not. You can also write your own function to determine whether page is empty or not based on specific requirements. For reference, please see below code

 Document doc = new Document("d:/test.pdf");

foreach (Page page in doc.Pages)

{

Console.WriteLine("Page 
{0} is {1}", page.Number, IsBlankPage(page));

}
        static private bool HasOnlyWhiteColor(Page page)
        {

            foreach (Operator op
            in page.Contents)

                if (op is Operator.SetColorOperator)
                {

                    Operator.SetColorOperator
                    opSC = op as Operator.SetColorOperator;

                    System.Drawing.Color color = opSC.getColor();

                    if (color.R != 255 || color.G != 255 || color.B !=
                    255)

                        return false;

                }


            return true;

        }
        static private bool IsBlankPage(Page page)
        {
            if ((page.Contents.Count == 0 && page.Annotations.Count == 0) || HasOnlyWhiteColor(page))
            {

                return true;
            }
            else
            {

                return false;
            }
        }