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

Free Support Forum - aspose.com

Page.IsBlank(tresholdfactor) issues

Dear all,

I am making a windows service that removes blank pages from PDF files that were dropped in a folder.
I am using the aspose.PDF library to do this:
foreach (FileInfo PDFfile in INfolder.GetFiles("*.pdf"))
{
List blancPageNumbersList = new List();

                using (Aspose.Pdf.Document pdfDocument = Arco.AsposeWrappers.Pdf.GetDocument(PDFfile.FullName))
                {
                    try
                    {
                        foreach (Page page in pdfDocument.Pages)
                        {
                            if (page.IsBlank(0.01))
                            {
                                blancPageNumbersList.Add(page.Number);
                            }
                        }

                        int[] blancPageNumbers = blancPageNumbersList.ToArray();
                        pdfDocument.Pages.Delete(blancPageNumbers);

                        
                    }
                   
                }

Some PDF’s are processed correctly by the service, but others are not. When I use the online service you provide (https://products.aspose.app/words/removepages/pdf#) to remove blank pages, all PDF files are processed correctly. Is it possible to share the code behind this service that is relevant for my problem? (treshold value, way of processing etc)

Many thanks in advance!

@MaartenMorreels

Perhaps, you are using Aspose.PDF in evaluation mode. Please get 30 days temporary license and apply it before using your code.

If you still face problem, please attach your input PDF file that is not processed correctly here for testing. We will investigate the issue and provide you more information on it.