combine on Y with variation of 1 (instead of being strict)

This commit is contained in:
Johannes Zillmann 2017-02-14 20:24:01 +01:00
parent a1222544bb
commit ab5705cd27

View File

@ -71,7 +71,7 @@ export default class CombineSameY extends Transformation {
} }
pdfPage.textItems.forEach(textItem => { pdfPage.textItems.forEach(textItem => {
if (textItemsWithSameY.length == 0 || textItem.y == textItemsWithSameY[textItemsWithSameY.length - 1].y) { if (textItemsWithSameY.length == 0 || Math.abs(textItem.y - textItemsWithSameY[textItemsWithSameY.length - 1].y) < 2) {
//fill array //fill array
textItemsWithSameY.push(textItem); textItemsWithSameY.push(textItem);
} else { } else {