Skip to content
Snippets Groups Projects
Commit 63f46a63 authored by Zdravko Iliev's avatar Zdravko Iliev
Browse files

reduce parsing time for big pdfs

parent fb542b0d
No related branches found
No related tags found
1 merge request!1Draft: Resolve "[Document Sealing] Implement PDF parser"
Pipeline #50369 failed with stages
in 26 seconds
......@@ -7,11 +7,11 @@ exports.config = {
get: {
// enable or disable data extraction (all are optional and enabled by default)
pages: true,
text: true,
fingerprint: true,
outline: true,
metadata: true,
text: false,
fingerprint: false,
outline: false,
metadata: false,
info: true,
permissions: true, // get permissions
permissions: false, // get permissions
},
};
......@@ -26,16 +26,8 @@ class PDFparser {
throw new errors_1.AppError("Only pdf file type is supported");
}
try {
// await Promise.all([
// verifyPDF(this.document),
// PdfData.extract(this.document, config),
// ]);
// console.time("verify");
const signaturesMeta = yield (0, lib_1.verifyPDF)(this.document);
// console.timeEnd("verify");
// console.time("PdfData");
const pdfMeta = yield pdfdataextract_1.PdfData.extract(this.document, config_1.config);
// console.timeEnd("PdfData");
const result = {
pages: pdfMeta.pages,
title: pdfMeta.info.Title || "Unknown",
......
......@@ -5,11 +5,11 @@ export const config = {
get: {
// enable or disable data extraction (all are optional and enabled by default)
pages: true, // get number of pages
text: true, // get text of each page
fingerprint: true, // get fingerprint
outline: true, // get outline
metadata: true, // get metadata
text: false, // get text of each page
fingerprint: false, // get fingerprint
outline: false, // get outline
metadata: false, // get metadata
info: true, // get info
permissions: true, // get permissions
permissions: false, // get permissions
},
};
......@@ -30,17 +30,8 @@ class PDFparser {
}
try {
// await Promise.all([
// verifyPDF(this.document),
// PdfData.extract(this.document, config),
// ]);
// console.time("verify");
const signaturesMeta = await verifyPDF(this.document);
// console.timeEnd("verify");
// console.time("PdfData");
const pdfMeta = await PdfData.extract(this.document, config);
// console.timeEnd("PdfData");
const result = {
pages: pdfMeta.pages,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment