Comments (5)
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.
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.
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.
fixed in v1.0.7
from pdf2json.
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)
- Node.js Server got stuck when parsing specific PDF while it is working for other PDFs HOT 2
- fields with periods are truncated HOT 1
- TypeError: pdf2json_1.default is not a constructor HOT 3
- Property 'getRawTextContent' does not exist on type 'Pdfparser'.ts(2339) HOT 6
- The interface for `Line` is missing the `l` property HOT 1
- ENOENT: no such file or directory - util.js HOT 10
- How to detect the HLines correctly?
- Without a ToUnicode CMap, PDF viewers can't map glyphs to Unicode values -> rely on pdf.js?? HOT 2
- Characters coming as NULL HOT 1
- Is the auto-merge broken text blocks capability active in the last stable version (3.0.5)? HOT 3
- Cloudflare Worker issue with Could not resolve "fs/promises" HOT 5
- something is colossaly f***** up in the exports for version 3.1.0 HOT 2
- ENOENT: no such file or directory, open '/var/task/../package.json' HOT 2
- no such file or directory - pkinfo.js HOT 1
- PDF parse, edit and retain HOT 1
- Cannot compile project with 3.1.3 HOT 5
- All PDF Parsing fails after upgrading from v3.1.2 to v3.1.3
- unexpected space HOT 7
- Parser NO SPACE - "pdf2json": "^3.1.3", HOT 1
- FATAL ERROR: JavaScript heap out of memory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdf2json.