Skip to content Skip to sidebar Skip to footer

Pdfjs Viewer With External File Upload

I am loading the pdf.js viewer in my webpage in a div using the pdf.js API methods such as run and open. In this page I also have a file upload section to attach related documents

Solution 1:

Here is the offending part in PDFViewerApplication, it adds a global change event listener and changes the pdf if it's a file input with files selected.

Unfortunately there is no settings flag to disable this behaviour, no reference to the listener function to remove it, and also no way to cancel or change the event (it would also break other parts of the app), so you'll have to modify this code to remove it. Seems like the listener just dispatches a new internal fileinputchange event which is only used for this, so you only need to comment out this line.

Post a Comment for "Pdfjs Viewer With External File Upload"