Улучшение конвертирования Pdf
This commit is contained in:
@@ -100,13 +100,26 @@ class ConvertPdf extends ConvertHtml {
|
|||||||
|
|
||||||
//формируем текст
|
//формируем текст
|
||||||
let text = `<title>${title}</title>`;
|
let text = `<title>${title}</title>`;
|
||||||
|
let concat = '';
|
||||||
|
let sp = '';
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
|
if (concat == '') {
|
||||||
const left = line.left || 0;
|
const left = line.left || 0;
|
||||||
const sp = ' '.repeat(indents[left]);
|
sp = ' '.repeat(indents[left]);
|
||||||
|
|
||||||
text += sp + line.text + "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let t = line.text.trim();
|
||||||
|
if (t.substr(-1) == '-') {
|
||||||
|
t = t.substr(0, t.length - 1);
|
||||||
|
concat += t;
|
||||||
|
} else {
|
||||||
|
text += sp + concat + t + "\n";
|
||||||
|
concat = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (concat)
|
||||||
|
text += sp + concat + "\n";
|
||||||
|
|
||||||
return await super.run(Buffer.from(text), {skipCheck: true, isText: true, cutTitle: true});
|
return await super.run(Buffer.from(text), {skipCheck: true, isText: true, cutTitle: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user