Code Monkey home page Code Monkey logo

Comments (5)

modesty avatar modesty commented on June 16, 2024

This problem is a direct reflection of PDF text data stream structure: the string is in 2 text blocks in PDF, although it "appears" as one visually. Currently, I don't have enough time to work on an "auto word merge" or "auto word concatenation" during parsing, if anybody wants to take it on, a pull request is welcomed.

from pdf2json.

RST-J avatar RST-J commented on June 16, 2024

Looking at the JSON above, shouldn't attribute w refer to the width of text and if so, x + w for the first text be less or equal to x of the second? If so, they appear to be in different units.

from pdf2json.

modesty avatar modesty commented on June 16, 2024

Short answer is no. Because there might be kernings or spacings between them. But you are right about the unit, w should be converted by lib/pdfunit. Because the w value is not always accurate so it's not used in client renderer, I may forget to process it. I'll take a look at it when I get some time.

from pdf2json.

modesty avatar modesty commented on June 16, 2024

fixed in v1.0.7

from pdf2json.

matewka avatar matewka commented on June 16, 2024

I'm still experiencing the unit issue on v1.1.7.
In my case the original text says:

"4)narzędzia i urządzenia, których używanie może zagrażać życiu lub zdrowiu:"

while the JSON output is:

{
  "x": 4.183,
  "y": 4.811,
  "w": 21.323999999999998,
  "sw": 0.32553125,
  "clr": 0,
  "A": "left",
  "R": [
     {
       "T": "4)na",
       "S": -1,
       "TS": [
         0,
         15,
         0,
         0
       ]
     }
   ]
 },
{
  "x": 6.486,
  "y": 4.811,
  "w": 354.54,
  "sw": 0.32553125,
  "clr": 0,
  "A": "left",
  "R": [
    {
      "T": "rz%C4%99dzia%20i%20urz%C4%85dzenia%2C%20kt%C3%B3rych%20u%C5%BCywanie%20mo%C5%BCe%20zagra%C5%BCa%C4%87%20%C5%BCyciu%20lub%20zdrowiu%3A",
      "S": -1,
      "TS": [
        0,
        15,
        0,
        0
      ]
    }
  ]
}

It doesn't seem to add up.
The text from the first object is a part of the first word from the second object (don't mind the "4)" - let's just treat it as one word), so x + w from the first object should be somewhere between x and x + sw from the second object, right?

Am I doing something wrong?

from pdf2json.

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.