mirror of
https://github.com/jzillmann/pdf-to-markdown.git
synced 2024-11-25 09:13:49 +01:00
don’t divide by fontHeight if result is < 0
This commit is contained in:
parent
9977814d34
commit
e90226c1d8
@ -57,17 +57,18 @@ export default class LoadingView extends React.Component {
|
||||
var viewport = page.getViewport(scale);
|
||||
page.getTextContent().then(function(textContent) {
|
||||
const textItems = textContent.items.map(function(item) {
|
||||
var tx = PDFJS.Util.transform( // eslint-disable-line no-undef
|
||||
const tx = PDFJS.Util.transform( // eslint-disable-line no-undef
|
||||
viewport.transform,
|
||||
item.transform
|
||||
);
|
||||
var fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3]));
|
||||
|
||||
const fontHeight = Math.sqrt((tx[2] * tx[2]) + (tx[3] * tx[3]));
|
||||
const dividedHeight = item.height / fontHeight;
|
||||
return new TextItem({
|
||||
x: item.transform[4],
|
||||
y: item.transform[5],
|
||||
width: item.width,
|
||||
height: item.height / fontHeight,
|
||||
height: dividedHeight <= 1 ? item.height : dividedHeight,
|
||||
text: item.str
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user