question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Objects larger than screen are only rendered to the max screen size

See original GitHub issue

Hi,

I discovered that objects (e.g. a DIV) larger than the screen (e.g. Shown with scroll-bars) would only render to the max dimensions of the screen.

Changing this line:-

return renderDocument(node.ownerDocument, options, node.ownerDocument.defaultView.innerWidth, node.ownerDocument.defaultView.innerHeight).then(function(canvas) 

to this:-

return renderDocument(node.ownerDocument, options, $(node).width(), $(node).height()).then(function(canvas)

resolves the issue.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:2
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
cenapcommented, Dec 20, 2014

Ok. I applied Lennyman’s workaround without touching the html2canvas code: Suppose your target is $(element)

    var h = $(element)[0].ownerDocument.defaultView.innerHeight;
    $(element)[0].ownerDocument.defaultView.innerHeight = $(element).height();
    html2canvas($(element)).then(function(canvas) {
        $(element)[0].ownerDocument.defaultView.innerHeight = h;
        //Do whatever you want with your canvas
    }
0reactions
gopinath-sixtcommented, Nov 20, 2017

@cenap : Ur logic… rocked!!! thank a lot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Need to make SDL/OpenGL window size larger than ...
Use a framebuffer object with an appropriately sized renderbuffer target. If the maximum supported renderbuffer size doesn't suffice your ...
Read more >
Windows scaling issues for high-DPI devices
Select Display > Change the size of text, apps, and other items, and then adjust the slider for each monitor.
Read more >
The picture looks too big, stretched, does not fit the screen ...
IMPORTANT: In this topic, TV settings to display the appropriate size of image on the TV and its effects are introduced.
Read more >
Sizing items in CSS - Learn web development | MDN
Images should be appropriately sized to be no larger than they need to be for the largest size they are displayed in the...
Read more >
Responsive Design Tutorial: Media Query Examples & More
<link rel="stylesheet" media="screen and (max-device-width: 480px)" ... For example, this portion of our responsive CSS would only be used if the current ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found