Skip to content
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

iframe support possible #8

Closed
sbittmann opened this issue Mar 21, 2017 · 4 comments
Closed

iframe support possible #8

sbittmann opened this issue Mar 21, 2017 · 4 comments

Comments

@sbittmann
Copy link

Is it possible to support iframes inside the PDFWindow

Using

<html><body>
<iframe width="500" height="500" src="test.pdf"></iframe>
</body></html>

only brings up a "Save As Dialog"

@haribabu500
Copy link

same issue. guess not possible...

@natchkebiailia
Copy link

@sbittmann @haribabu500
You have to change url in iframe src:

change
src="filename.pdf"
to
src="path_to_pdfjs_viewer.html?file=filename.pdf"

You can also use external library url:
src="https://mozilla.github.io/pdf.js/web/viewer.html?file=filename.pdf"
N.B you have to encodeURIComponent("filename.pdf") before passing as a parameter

@Erim32
Copy link

Erim32 commented Aug 29, 2018

Hello, any update ?

@ram-you
Copy link

ram-you commented Sep 15, 2018

Hi , you can use Webview in place of iframe :

var webview = document.querySelector('webview');

//important : webview have not webContents like browser window do

webview.webContents = webview.getWebContents();

PDFWindow.addSupport(webview);

Then
webview.loadURL(yourFile.pdf)

Hope this help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants