Улучшение парсинга pdf
This commit is contained in:
@@ -43,6 +43,7 @@ class ConvertPdf extends ConvertHtml {
|
|||||||
let title = '';
|
let title = '';
|
||||||
let prevTop = 0;
|
let prevTop = 0;
|
||||||
let i = -1;
|
let i = -1;
|
||||||
|
let titleCount = 0;
|
||||||
|
|
||||||
const loadImage = async(image) => {
|
const loadImage = async(image) => {
|
||||||
const src = path.parse(image.src);
|
const src = path.parse(image.src);
|
||||||
@@ -76,8 +77,10 @@ class ConvertPdf extends ConvertHtml {
|
|||||||
tClose += (bold ? '</b>' : '');
|
tClose += (bold ? '</b>' : '');
|
||||||
|
|
||||||
lines[i].text += `${tOpen}${text}${tClose} `;
|
lines[i].text += `${tOpen}${text}${tClose} `;
|
||||||
if (i < 2)
|
if (titleCount < 2 && text.trim() != '') {
|
||||||
title += text + ' ';
|
title += text + (titleCount ? '' : ' - ');
|
||||||
|
titleCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user