Skip to content

Is it possible to get the xref for a block? #1158

Description

@phper5

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

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions