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

Regression on rendering the whole document on a scrolled page #893

Closed
ludrao opened this issue Jun 20, 2016 · 4 comments
Closed

Regression on rendering the whole document on a scrolled page #893

ludrao opened this issue Jun 20, 2016 · 4 comments

Comments

@ludrao
Copy link

ludrao commented Jun 20, 2016

There seems to be a regression (0.5.0-beta4 compared to 0.5.0-alpha1) that crops the content of the rendering from the top of the vertical scroll position: what is above scroll top is cropped. It behaves almost as if options.type="view", except the options is not set. Though the canvas has the correct document size (not the view/window size, and the remainder of the space is filled with blank)

The rendering is done on the whole body (html2canvas($('body'))

I'll try to narrow down the commit that caused the regression if I can find the time! Sorry for the short description, but I thought I'd still report a bug in case someone is having it as well.

Thx

@AmolKur
Copy link

AmolKur commented Aug 8, 2016

I am getting same issues. After view port all the contents are black out.

parallax/jsPDF#793

@mintplo
Copy link

mintplo commented Aug 15, 2016

You should check getBounds function in html2canvas.js.

Because this function return value for target node's bounding area while rendering.

this function uses getBoundingClientRect API but this function relatives to viewport. so, you should fix this function to fit element without scroll position value.

Check this Ref-link.
https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect

i hope you solve this issue.

@mintplo
Copy link

mintplo commented Aug 15, 2016

@rakshitjat
Copy link

I am getting same issues.(html2canvas)

parallax/jsPDF#793

const doc = new jsPDF("p", "mm", "a4");
html2canvas(document.getElementById('myIdName'), {
allowTaint: true,
useCORS: true,
scale: 4,
}).then(function (canvas) {

        const img = canvas.toDataURL("image/jpeg", 0.1);
        doc.addImage(img,'JPEG', 20, -20,  canvas.width * 0.038, canvas.height * 0.038);
        doc.addPage("a4");
    })

only change in scale ... decrease 4 to 2 and it works ... i think issue is resolution of screen ... try it ... Good Luck

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