New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running pdf.js with electron #7135
Comments
That's really old version. Already pre-built version from our releases (or
That indicates that core PDF.js library ('./build/pdf.js' file) was not loaded. |
package.json does not contain the built library version, see pdf.js file or PDFJS.version property for right version number.
Both of them shall be identical. You have to use entire "generic/" folder, so you will have pdf.js in right place. |
It says version:1.4.174 Also, I figured out the problem. I copied the right stuff from the generic directory; however when I open a window with the viewer.html url; the window property should have this:
And it is able to load fine now. Thanks for your help Yury! |
Hello,
I am trying to integrate pdf.js library with the electron app. The main reason behind doing that is to have a pdf viewer in the app and to print the document.
First of all, I tried to integrate the library in two ways:
I have following questions:
`
However, this is just part of the thing I want. I want the viewer controls like in viewer.html. So, I tried to open a new window with directly viewer.html like this:
var pdfPath = __dirname + '/pdfs/trial.pdf'; mainWindow.loadURL('file://' + __dirname + '/generic/web/viewer.html?file=' + pdfPath);
I was able to see the viewer, but while loading the pdf file, it throws this error in console:
Uncaught (in promise) TypeError: PDFJS.getDocument is not a function
at Object.pdfViewOpen as open
at webViewerInitialized (file:///.../src/generic/web/viewer.js:7686:26)
I am not able to figure out what am I doing wrong here. Is this the recommended way? Also, if I want to embed that whole viewer in some canvas or some iframe, how can I do that? It would be nice to have an API list in the project for doing certain common tasks like what I am trying. Sorry, if it is already there and I am not able to find it.
It would be greatly appreciated if someone could help me out here.
Thanks in advance...
Configuration:
The text was updated successfully, but these errors were encountered: