niklasvh / html2canvas

Screenshots with JavaScript
https://html2canvas.hertzen.com/
MIT License
30.5k stars 4.8k forks source link

Issue with IE and rendering inline vertical scroll bar #1318

Open smkart opened 6 years ago

smkart commented 6 years ago

Issue :

We have a grid with contains multiple charts ( highchart ) and table ( Datatable )

We are trying to export the grid as png, So below is the expected end result

dashboard 47

The above exported image is done with https://github.com/tsayen/dom-to-image ( but this library don't have support for IE which is need for my project )

Using our library we are trying to export the same in both IE and chrome browsers. But facing few below issues

  1. In IE it doesn't export highcharts and fa-fa-icons, Also all the objects where placed at incorrect position
    Result in IE as below : dashboard 48

  2. In Chrome when the window is having inner scroll bar then it ignores the scroll bar and displaying all the content inside the division

    • Scroll bar appears because of the CSS ( overflow : auto ) which means the library is not working with this CSS dashboard 50

Above image the table chart overlaps all the content ( Please compare it with expected image )

Same can be reproduced in fiddle with normal text: http://jsfiddle.net/manigandan2693/hv5yfe3c/1/

  1. Both Chrome and IE takes screen shot of only the page which is in current window view ( Example : It ignores the page which we have to view by scrolling the page ) -> Please compare it with expected png image above

Code used to create png :

dashboard_export_code

It would be helpful if the issue gets fixed ASAP since we are nearing to our project release

Please revert back for any clarification

Bug reports:

http://jsfiddle.net/manigandan2693/hv5yfe3c/1/

Specifications:

niklasvh commented 6 years ago

Thanks for the well written bug report and example! Will get this fixed soon

smkart commented 6 years ago

Thanks for accepting as bug , I hope we will get fix soon ( Since we are nearing to our project release )

It would be helpful if you can give some ETA for fix :)

Thanks Mani

niklasvh commented 6 years ago

Should be partially fixed with https://github.com/niklasvh/html2canvas/commit/38749bc4b6a861f778a915491fc7d84fea6e1a2f

smkart commented 6 years ago

Thanks for working on it , With the above fix I can see below improvements in chrome and IE

Expected result :
image

  1. Chrome browser - Content appears over the scrollbar is fixed in Chrome as you can see in the actual result after 1.0.0-alpha.5 fix dashboard 55

  2. In IE it remains - It was not able to render highcarts SVG as you see empty panels , And scale which renders appears to be much wider than actual dashboard 56

  3. It skips to take image of contents below the current screen ( content which we need to scroll down and view from current screen window ) in both IE and chrome

Hope the above information will help you to narrow down more

smkart commented 6 years ago

Hi ,

Is there any update regarding the Fix ? , It would be so helpful if you fix it ASAP

Thanks Mani Applied Materials

FDIM commented 6 years ago

@Mani2693 keep in mind that if your charts are rendered to svg, they wont work out of the box (at least in IE). We are using canvg library to convert these cases to canvas. We also needed a workaround for tag.

smkart commented 6 years ago

Thanks for the response, I will look into canvg library

I also need help with position of elements in resultant image , If we compare with Excepted result all the elements in the actual result are zoomed and misplaced with wider space between them, Many of the element going wider in position than its original position

And also It stopped capturing elements which are placed below current window ( one which we can view by scrolling down )

Please need help as soon as possible , we are running out of time here , sorry

Thanks again

Regards, Mani Applied Materials

smkart commented 6 years ago

Hi Team,

Sorry we need to fix ASAP since this is very important fix, I request any fix/workaround for this issue

Please consider fixing it

Thanks Mani