-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
HTML2canvas not working in Firefox for larger size SVG html elements #2881
Comments
Is anyone knows the solution for the above issue? |
Looks like plugin author don't have any solution for the above issue |
Does the developer tools console give you any messages? |
Thanks for your reply. See debug messages in console for HTML2canvas library: #1 0ms Starting document clone with size 1536x434 scrolled to 0,0 #1 30376ms Error loading svg data:image/svg+xml,%3Csvg%20class%3D%22productimg%22%20version%3D%221.1%22%20id%3D%22Layer_3%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20x%3D%220px%22%20y%3D%220px%22%20viewBox%3 #1 30631ms Finished rendering After above console messages See screenshot for console messages: All good with chrome See my main comment for this issue Thanks |
@niklasvh |
no solution to this? Having the same problem. Only my svg is around 1MB in contrast to @jackturner4416 58MB. Works on Chrome, but gives Error loading svg data on Firefox |
I prepared to stackblitz eg. This one works on Firefox: https://stackblitz.com/edit/angular-ivy-4vzrey?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html This one has a little larger svg file and it crashes on Firefox: https://stackblitz.com/edit/angular-ivy-4vzrey?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html |
@Andranik-89 @jackturner4416 Sorry for being so slow to respond. After just barely visiting the links @Andranik-89 provided I couldn't seem to reproduce the issue on |
@niklasvh @coder0107git I have checked SVG element scenario with 3 SVGs as below with same code of HTML2canvas: Can you please help me with the above issue? Thanks in advance !! |
@jackturner4416 Can you please provide the three SVGs and the code you tried? |
@coder0107git Zip file contains all 3 SVG files Please check for the zip file, Thanks. |
@jackturner4416 I will test it when I have time later today. |
@coder0107git Thanks One more issue Same SVG elements renders different jpg/png images (when screen resize) It should generate same image for all screen resolution Thanks in advance !! |
@jackturner4416 After playing around with the code for a little bit I ran into some issues. Both |
@coder0107git I have checked the same code you provided in your last reply Tested with Firefox, not working in Firefox browser One more thing: As per my code and our requirements we need: After that we need to save that image as jpg/png Image should be proper for all screen sizes As per my code:
Need solution for above issues, please check for the above |
@coder0107git |
@jackturner4416 I can't work on this until at least next week. I will try to work on this after I am (hopefully) in a better position with homework. |
Okay @coder0107git Waiting for your help for below issues:
Let me know once you have any updates for the above Thanks !! |
I am seeing the same problem on Firefox for larger (>600K) SVG elements. Smaller elements work ok. |
@jimmyangel @jackturner4416 What Firefox version(s) are you using? Also, what html2canvas version(s) are you using? What operating system are you using? How much ram does the computer have? What type of CPU architecture is the system (eg: |
@jimmyangel @coder0107git Firefox version: 106.0.2 (64-bit) Summary:
@coder0107git Update here once you test my code OR find any solution |
@coder0107git You can see the issue here: https://biodiversidad-provita.netlify.app/en/faunarb/?tab=graph Click on the camera icon - large SVG does not work (empty space). Console shows: #4 6010ms Error loading svg data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20style%3D%22width%3A%201102.4px%3B%20transition%3A%20all%200s%20ease%200s%3B%20-webkit-text-stroke%3A%200px%20rgb(74%2C%2074%2C%2074)%3B%20-webkit-text-fill-color%3A%20rgb(74% Click on "Arthropoda" slice to generate simpler graph. Click on camera icon. Smaller SVG works. No errors in Console. Works fine in Safari and Chrome. Thanks |
@jimmyangel When I test the link you provided and try to capture the whole chart on Chrome the page just crashes. When I try to open the page on @jackturner4416 Other than the above I haven't currently made anymore progress. |
@coder0107git I didn't found any solution for above 2 issues |
@coder0107git |
@jackturner4416, have you tried the imageTimeout option? I'm not sure, but maybe the large image didn't have time to load. |
yes @RomanChumakov, I already used timeout function with 1 second setTimeout(function () { Still I am facing issues as I mentioned in this ticket @coder0107git Any thoughts? or other solution or library code? |
@jackturner4416 For your current use case is there any benefit to use html2canvas to render the SVGs client side vs. converting the SVGs to a high quality |
@coder0107git we don't need to render SVG image can you please provide me a piece of code? I already provided a zip file with my code |
@jackturner4416 After doing some testing with |
@jackturner4416 Another |
@coder0107git I don't have any image url with .svg We need to convert png image for particular div code Can you please provide me some demo code? OR any chances to fix larger image issue for firefox in your library? |
@jackturner4416, the dom-to-image library can also help. At least in my project it works better than html2canvas |
@jackturner4416 I have my |
@coder0107git |
So no solutions for html2canvas ? |
I have used your library HTML2canvas for generate SVG element HTML part to image
https://html2canvas.hertzen.com/
For smaller or medium size SVG elements it's working proper with firefox and chrome both
When SVG size will be larger
it's only working on Chrome
and in firefox browser latest version it's creating blank white image only
Is there any file size limitations to create canvas in browsers? Please provide me more details if there is any limitations for library or SVG firefox
For larger SVG size canvas is not rendering for firefox latest browser (working in chrome instead)
I have checked SVG element scenario with 3 SVGs as below with same code of HTML2canvas:
2kb SVG elements - Chrome (working) - Firefox (working)
1.5MB SVG elements - Chrome (working) - Firefox (working)
58MB SVG elements - Chrome (working) - Firefox (not working)
Can you please help me with the above issue?
Thanks in advance !!
Specifications:
The text was updated successfully, but these errors were encountered: