View Single Post
Old 05-14-2023, 01:37 PM   #11
Shohreh
Addict
Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.Shohreh ought to be getting tired of karma fortunes by now.
 
Posts: 207
Karma: 304158
Join Date: Jan 2016
Location: France
Device: none
Parse the whole PDF, ignoring the first page of each chapter:

Code:
import fitz

doc = fitz.open("original.pdf")
rect = fitz.Rect(0,0,424,50)
exclude = [range(1, 14), 17,24,97,155,186,232,258,297,322,343,404]
for index in range(1,doc.page_count+1):
	if index not in exclude:
		page = doc[index]
		page.add_redact_annot(rect)
		page.apply_redactions()
doc.save("redacted.pdf")
Shohreh is offline   Reply With Quote