Giter VIP home page Giter VIP logo

Comments (7)

cajmorgan avatar cajmorgan commented on July 22, 2024

The bug seems to appear in version 1.24.0 after some testing

from pymupdf.

JorjMcKie avatar JorjMcKie commented on July 22, 2024

Please provide reproducing file. So far, we would be forced to guessing.

from pymupdf.

cajmorgan avatar cajmorgan commented on July 22, 2024

Of course, sorry. This is one page of the doc. I justed tested it and the error happens, though as mention, only after version 1.23.9 it seems

error-doc.pdf

from pymupdf.

JorjMcKie avatar JorjMcKie commented on July 22, 2024

Sorry for the delay.
You haven't supplied reproducing code, so I have tried the following, which does not reveal problem behavior (version 1.24.5):

for r in page.search_for("genocide"):
    page.add_redact_annot(r)

    
'Redact' annotation on page 0 of error-doc.pdf
page.apply_redactions()
True
doc.ez_save("redacted.pdf")
pymupdf.version
('1.24.5', '1.24.2', '20240530000001')

from pymupdf.

cajmorgan avatar cajmorgan commented on July 22, 2024

Of course,

boxes = [some boxes here]
 pdf = pymupdf.open(doc_path)

        for i, page in enumerate(pdf):

            for box in boxes

                rect = pymupdf.Rect(
                    box[0],
                    box[1],
                    box[2],
                    box[3],
                )
                fontsize = 12

                page.add_redact_annot(
                    rect,
                    text="[REDACTED]",
                    text_color=(0, 0, 0),
                    fill=(1, 0, 0),
                    fontsize=fontsize,
                    align=pymupdf.TEXT_ALIGN_CENTER,
                )

            page.apply_redactions()

        path = "somepath"

        pdf.save(path)

from pymupdf.

cajmorgan avatar cajmorgan commented on July 22, 2024

There was a problem with a newer version with .TEXT_ALIGN_CENTER, it may be related to that or something else.

from pymupdf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.