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

Preview in browser #519

Closed
g41n opened this issue Feb 17, 2016 · 6 comments
Closed

Preview in browser #519

g41n opened this issue Feb 17, 2016 · 6 comments

Comments

@g41n
Copy link

g41n commented Feb 17, 2016

I need a preview of the PDF in browser... can I have it as image or HTML? Is there any method like "toCanvas" or something like that?

@ryanlin1986
Copy link

You should use pdf.js to do this
https://github.com/mozilla/pdf.js

@g41n
Copy link
Author

g41n commented Feb 18, 2016

Thanks for the response but I need something to show it before the PDF generation.
Does the JSON for the doc definition follow some standard? In this case, is there and interpreter to convert it into HTML?

@daniellizik
Copy link

You can take the base64 data url and use it as the src attribute in an iframe. See the jspdf homepage for an example. This comment details the methods used to get the base64 url of a pdf.

@stodolos
Copy link

The getBase64 method yielded the following error for me:

HTTP Error 414. The request URL is too long.

The getDataUrl method seems to work just fine though. The problem is with IE though. Nothing appears...

I was wondering if it's possible to mix both pdfMake and pdf.js (which works in IE) together. I only see how to use pdf.js with an actual file, but not with an object or dataUri or something.

Any thoughts?

@tlk
Copy link

tlk commented Jan 23, 2017

Perhaps this could be used: http://stackoverflow.com/a/12094943/936466

@liborm85
Copy link
Collaborator

Answered.

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

6 participants