@vestfoldfylke/pdf-text-extract
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -1,2 +0,6 @@ | ||
const pdfjsLib = require('pdfjs-dist/legacy/build/pdf.js') | ||
const getPdfDocument = async (pdf) => { | ||
const { getDocument } = await import('pdfjs-dist/legacy/build/pdf.min.mjs') | ||
return await getDocument(pdf) | ||
} | ||
// Need the legacy build to work with Node - newer versions require Canvas to work, we don't want it | ||
@@ -50,3 +54,3 @@ | ||
} | ||
const loadingTask = await pdfjsLib.getDocument(pdf) | ||
const loadingTask = await getPdfDocument(pdf) | ||
const doc = await loadingTask.promise | ||
@@ -53,0 +57,0 @@ pdfData.metadata = await doc.getMetadata() |
{ | ||
"name": "@vestfoldfylke/pdf-text-extract", | ||
"description": "Node module that extracts metadata, text-content, and styling from readable pdf-files", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"main": "index.js", | ||
@@ -28,3 +28,3 @@ "scripts": { | ||
"dependencies": { | ||
"pdfjs-dist": "2.16.105" | ||
"pdfjs-dist": "^4.2.67" | ||
}, | ||
@@ -34,2 +34,2 @@ "devDependencies": { | ||
} | ||
} | ||
} |
@@ -17,3 +17,2 @@ # pdf-text-extract | ||
const pdf = 'https://<url-to-pdf>.pdf' // Network resource. Remember to handle CORS if using url | ||
const pdf = readFileSync('./<path-to-pdf>.pdf') // Buffer (doesnt have to come from readFile - just as an example) | ||
const pdf = new Uint8Array(readFileSync('./<path-to-pdf>.pdf')) // Uint8Array (doesnt have to come from readFile - just as an example) | ||
@@ -20,0 +19,0 @@ const pdf = { url: './<path-or url-to-pdf>.pdf', data: 'arrayBuffer or similar', verbosity: 0, ...options } // use either url or data - options are found in typedef, verboosity: 0 for suppressing logs |
77
10518
222
+ Added@napi-rs/canvas@0.1.66(transitive)
+ Added@napi-rs/canvas-android-arm64@0.1.66(transitive)
+ Added@napi-rs/canvas-darwin-arm64@0.1.66(transitive)
+ Added@napi-rs/canvas-darwin-x64@0.1.66(transitive)
+ Added@napi-rs/canvas-linux-arm-gnueabihf@0.1.66(transitive)
+ Added@napi-rs/canvas-linux-arm64-gnu@0.1.66(transitive)
+ Added@napi-rs/canvas-linux-arm64-musl@0.1.66(transitive)
+ Added@napi-rs/canvas-linux-riscv64-gnu@0.1.66(transitive)
+ Added@napi-rs/canvas-linux-x64-gnu@0.1.66(transitive)
+ Added@napi-rs/canvas-linux-x64-musl@0.1.66(transitive)
+ Added@napi-rs/canvas-win32-x64-msvc@0.1.66(transitive)
+ Addedpdfjs-dist@4.10.38(transitive)
- Removeddommatrix@1.0.3(transitive)
- Removedpdfjs-dist@2.16.105(transitive)
- Removedweb-streams-polyfill@3.3.3(transitive)
Updatedpdfjs-dist@^4.2.67