1 My real intention is to delete a piece of text. I get the text by for block in page.get_text("dict", flags=extr_flags)["blocks"]: But how can I delete it? can I get the xref for the block?
2 I noticed there is a code https://github.com/pymupdf/PyMuPDF-Utilities/tree/master/font-replacement
in this code it can remove text written with one of the fonts.
this is a solution, I saved all the text which use the same font, and delete all the text which use this font. and then rewrite the text I do not want to delete. It will works. But I have to delete a lot text, and then write it back Is there a better way?
3 Follow the code above, it checked the font name to location in the stream, Can I locate the word in the stream directly? How? I found someone user code like this stream = doc.xref_stream(xref).replace(b'seard',b'kjhkj') but it not work for me.
so how can i do if i just want to delete a few word in the pdf
thanks
1 My real intention is to delete a piece of text. I get the text by
for block in page.get_text("dict", flags=extr_flags)["blocks"]:But how can I delete it? can I get the xref for the block?2 I noticed there is a code https://github.com/pymupdf/PyMuPDF-Utilities/tree/master/font-replacement
in this code it can remove text written with one of the fonts.
this is a solution, I saved all the text which use the same font, and delete all the text which use this font. and then rewrite the text I do not want to delete. It will works. But I have to delete a lot text, and then write it back Is there a better way?
3 Follow the code above, it checked the font name to location in the stream, Can I locate the word in the stream directly? How? I found someone user code like this
stream = doc.xref_stream(xref).replace(b'seard',b'kjhkj')but it not work for me.so how can i do if i just want to delete a few word in the pdf
thanks