Skip to content

Search problems #4180

Closed
Closed
@vlad-babin

Description

@vlad-babin

Description of the bug

Hello!
I have issues with searching in the document.

The problem is that the search results provide coordinates slightly above the actual line in the file.

This issue occurs in files that had the problem described in this #3751 (comment) before version 1.24.14.

I’m attaching the files for reference.
original.pdf
redacted.pdf

How to reproduce the bug

Here is the script that performs the search and deletes the lines.

input_file_path = request.kwargs["inputFilePath"]
search_value = "Reference is made"

doc = pymupdf.open(input_file_path)

for page in doc:
    instances = page.search_for(search_value)
    for inst in instances:
        page.add_redact_annot(inst, fill=(0, 0, 0))
    page.apply_redactions()

doc.save('redacted_document.pdf')
doc.close()

PyMuPDF version

1.25.0

Operating system

MacOS

Python version

3.12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions