Добавлена частичная поддержка формата Djvu

This commit is contained in:
Book Pauk
2020-12-03 21:30:50 +07:00
parent b5e563679a
commit bdb2ae57a8
6 changed files with 57 additions and 6 deletions

View File

@@ -14,17 +14,20 @@ class ConvertPdf extends ConvertHtml {
}
async run(notUsed, opts) {
if (!this.check(notUsed, opts))
return false;
if (!opts.skipCheck) {
if (!this.check(notUsed, opts))
return false;
}
await this.checkExternalConverterPresent();
const {inputFiles, callback, abort} = opts;
const {inputFiles, callback, abort, uploadFileName} = opts;
const inpFile = (opts.pdfFile ? opts.pdfFile : inputFiles.sourceFile);
const outFile = `${inputFiles.filesDir}/${utils.randomHexString(10)}.xml`;
//конвертируем в xml
let perc = 0;
await this.execConverter(this.pdfToHtmlPath, ['-nodrm', '-c', '-s', '-xml', inputFiles.sourceFile, outFile], () => {
await this.execConverter(this.pdfToHtmlPath, ['-nodrm', '-c', '-s', '-xml', inpFile, outFile], () => {
perc = (perc < 80 ? perc + 10 : 40);
callback(perc);
}, abort);
@@ -186,6 +189,8 @@ class ConvertPdf extends ConvertHtml {
indents[0] = 0;
//формируем текст
if (!title && uploadFileName)
title = uploadFileName;
let text = `<title>${title}</title>`;
let concat = '';
let sp = '';