How to load local pdf / from browser? #1264
Replies: 1 comment
-
Use HTML5's FileReader API <input type="file" id="fileInput"> let fileInput = document.getElementById('fileInput')
fileInput.addEventListener('change', (e) => {
let file = fileInput.files[0]
reader.onload = async (e) => {
const pdfDoc = await PDFDocument.load(e)
}
reader.readAsArrayBuffer(file)
}) I'm doing this off of memory only so there may be some tweaks needed, and might be better structure to doing this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys, how can I load a pdf without fetching it? I would love to use pdf-lib for a local application.
Beta Was this translation helpful? Give feedback.
All reactions