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

PDF quality with html2canvas scale returns a blank pdf #128

Open
talkshowhost opened this issue Jun 25, 2018 · 5 comments
Open

PDF quality with html2canvas scale returns a blank pdf #128

talkshowhost opened this issue Jun 25, 2018 · 5 comments
Labels

Comments

@talkshowhost
Copy link

Hi,

I've been trying to get the best possible quality and I've only been able by increasing the scale property on html2canvas. The best results I had were with 5, even though I'm not sure exactly which values I should use.

The problem is when the PDF has more than a certain number of pages it returns with all of them blank. At the moment with 16 pages I can use the value with 2. If they increase I have to decrease this value to 1.5 and so on.

Is there another way to do this or to fix this issue?

PS: I've seen the requests for a smart break functionality and there is a fork with it from App1e5auce, if this could be merged would be awesome :)

@Greensahil
Copy link

Did you manage to fix this?

@talkshowhost
Copy link
Author

No, but I think I found the source of the issue.

I believe it has something to do with the toDataURL() and data URI limits, since I have seen through debugging incomplete values which don't render properly.

I wanted to do some testing by splitting up images in the middle of the lib flow but had to work on other issues. Hope it helps someone to fix this. (one idea would be to have classes that would render straight to svg and pdf - not going through html2canvas - and the rest would be done with images)

@eKoopmans
Copy link
Owner

Hi @talkshowhost and @Greensahil, sorry I've been absent. It's a problem related to the maximum canvas width/height - see here.

One possible solution; html2canvas allows you to specify your own canvas, rather than create its own. It may be possible to create a "virtual" canvas object that acts like a canvas, but in fact stitches together multiple canvases if the max size is exceeded.

Regarding the smart pagebreaks - I'm on the case, looking at merging the various suggestions now.

@eKoopmans eKoopmans added the bug label Sep 11, 2018
@eKoopmans
Copy link
Owner

@talkshowhost for page-breaks, I've made a new PR #153 with a proposed upgrade, I'll merge it in after some testing.

@sohilfynd
Copy link

@eKoopmans when are planning to to solve this issue of Maximum canvas size. What i am doing is making 14 pdfs at time and again using same jsPDF object to add more pages. But cpu utilization and memory consumption increases too much when doing such operation for like 15 times.

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

No branches or pull requests

4 participants