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 = { ...@@ -7,11 +7,11 @@ exports.config = {
get: { get: {
// enable or disable data extraction (all are optional and enabled by default) // enable or disable data extraction (all are optional and enabled by default)
pages: true, pages: true,
text: true, text: false,
fingerprint: true, fingerprint: false,
outline: true, outline: false,
metadata: true, metadata: false,
info: true, info: true,
permissions: true, // get permissions permissions: false, // get permissions
}, },
}; };
...@@ -26,16 +26,8 @@ class PDFparser { ...@@ -26,16 +26,8 @@ class PDFparser {
throw new errors_1.AppError("Only pdf file type is supported"); throw new errors_1.AppError("Only pdf file type is supported");
} }
try { try {
// await Promise.all([
// verifyPDF(this.document),
// PdfData.extract(this.document, config),
// ]);
// console.time("verify");
const signaturesMeta = yield (0, lib_1.verifyPDF)(this.document); 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); const pdfMeta = yield pdfdataextract_1.PdfData.extract(this.document, config_1.config);
// console.timeEnd("PdfData");
const result = { const result = {
pages: pdfMeta.pages, pages: pdfMeta.pages,
title: pdfMeta.info.Title || "Unknown", title: pdfMeta.info.Title || "Unknown",
......
...@@ -5,11 +5,11 @@ export const config = { ...@@ -5,11 +5,11 @@ export const config = {
get: { get: {
// enable or disable data extraction (all are optional and enabled by default) // enable or disable data extraction (all are optional and enabled by default)
pages: true, // get number of pages pages: true, // get number of pages
text: true, // get text of each page text: false, // get text of each page
fingerprint: true, // get fingerprint fingerprint: false, // get fingerprint
outline: true, // get outline outline: false, // get outline
metadata: true, // get metadata metadata: false, // get metadata
info: true, // get info info: true, // get info
permissions: true, // get permissions permissions: false, // get permissions
}, },
}; };
...@@ -30,17 +30,8 @@ class PDFparser { ...@@ -30,17 +30,8 @@ class PDFparser {
} }
try { try {
// await Promise.all([
// verifyPDF(this.document),
// PdfData.extract(this.document, config),
// ]);
// console.time("verify");
const signaturesMeta = await verifyPDF(this.document); const signaturesMeta = await verifyPDF(this.document);
// console.timeEnd("verify");
// console.time("PdfData");
const pdfMeta = await PdfData.extract(this.document, config); const pdfMeta = await PdfData.extract(this.document, config);
// console.timeEnd("PdfData");
const result = { const result = {
pages: pdfMeta.pages, 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