python - How to identify if a page of PDF contains text using PyPDF2? -
the original task crop pdf several seperated parts. have adjusted params complete task,but sometimes, croping method lead 'blank page' looks like,it has text(using extracttext method). want know how filter 'blank page' mentioned above. below part of croping method: original = 'input.pdf' target = 'output.pdf' pdf = pdffilereader(open(original, 'rb')) page in pdf.pages: in range(4): new_page = copy.copy(page) if == 0: # top left new_page.mediabox.upperright = (285.5, 780) new_page.mediabox.lowerleft = (20, 570) elif == 1: # bottom left new_page.mediabox.upperright = (285.5, 400) new_page.mediabox.lowerleft = (20, 190) elif == 2: # top right new_page.mediabox.upperright = (572, 780) new_page.mediabox.lowerleft = (306.5, 570) elif == 3: # bottom right new_page.mediabox