GithubHelp home page GithubHelp logo

Comments (3)

JorjMcKie avatar JorjMcKie commented on May 19, 2024

Here is an example on how the function fz_print_text_page will print out a PDF page. The dotted rectangles indicates which boxes are (correctly) kept together. The red number in each box shows the printing sequence. As one can see, this sequence is totally illogical:
bild1

from pymupdf.

JorjMcKie avatar JorjMcKie commented on May 19, 2024

Feedback from MuPDF's Bugzilla page in essence signifies, that they consider it out of scope to adjust the output of fz_print_text_page, mainly because

  • the output sequence of this function comes from "the orders that the PDF file performs the marking operations".
  • fz__print_text_page_xml contains all information required to achieve a better result

So we will consider creating our own functionality for improving extractText().

from pymupdf.

JorjMcKie avatar JorjMcKie commented on May 19, 2024

I have modified the TextPage.extractText() method:
It now includes an optional integer parameter basic which indicates whether fz_print_text_page should be used (basic = True) or not.

If Basic = False is specified or defaulted, then fz_print_text_page_xml is invoked, and its return is transformed to create a better ordered plain text string, which is then passed back to the caller. The above example then looks like so:
bild2

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.