Blank Pages

67 views
Skip to first unread message

Agha Usman

unread,
Mar 19, 2021, 3:01:21 AM3/19/21
to pdfium
Hi, 

I'm using pdfium wrapper (DocNet) to merge pdf files. 

It is required to exclude the blank pages in the PDF file. So I was wondering what could be the best way to detect and remove blank pages. 

All I can guess from documentation is FPDFPage_CountObject function which presumably will return 0 in case of a blank page. 

I know how to extend the wrapper just after an expert advice on pdfium function to identify blank pages. 

Thanks

K. Moon

unread,
Mar 19, 2021, 11:25:28 AM3/19/21
to Agha Usman, pdfium
I think this depends on what you consider a blank page. For example, if a page has a rectangle that covers the entire page in the background color, is that still a blank page?

The most robust way to do this probably is to render the actual page, then check if all the pixels are the same color. If you wanted something faster (but less accurate), I think you would want to check if the content stream is empty (and maybe annotations, too, if you care about those); "no page objects" seems like it would cover that case.

--
You received this message because you are subscribed to the Google Groups "pdfium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pdfium/cef8ef37-c833-489f-87c6-6d201625487bn%40googlegroups.com.

Agha Usman Ahmed

unread,
Mar 21, 2021, 6:26:51 PM3/21/21
to K. Moon, pdfium
Hi Moon, 

How to check if the content stream and annotations are empty? 

Regards,

Agha Usman Ahmed


K. Moon

unread,
Apr 5, 2021, 2:29:21 PM4/5/21
to Agha Usman Ahmed, pdfium
I think your suggestion to check if there are any page objects would cover that case. If you have an example where it doesn't, we can take a closer look.
Reply all
Reply to author
Forward
0 new messages