- code import fix
This commit is contained in:
@@ -806,7 +806,9 @@ class PDFParserService {
|
||||
}
|
||||
|
||||
static async extractPdfTextWithLayout(filePath) {
|
||||
const { default: pdfjsLib } = await import('pdfjs-dist/legacy/build/pdf.js');
|
||||
// pdfjs-dist v5 publishes the legacy build as an ESM module (.mjs) and
|
||||
// exposes getDocument as a named export (there is no default export).
|
||||
const pdfjsLib = await import('pdfjs-dist/legacy/build/pdf.mjs');
|
||||
const pdfData = new Uint8Array(fs.readFileSync(filePath));
|
||||
const loadingTask = pdfjsLib.getDocument({ data: pdfData, disableWorker: true });
|
||||
const pdf = await loadingTask.promise;
|
||||
|
||||
Reference in New Issue
Block a user