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
Image tag is not capturing #145
Comments
You are missing the preload of images, which itself is asynchronous, so you'll need to wrap it in callbacks. You are probably using an older version as well, so I'd recommend getting the latest version from https://github.com/niklasvh/html2canvas/downloads and then testing with:
|
Thanks for the quick response, i downloaded the latest version and tried the above code, its still not showing up image tag in the rendered canvas. Am i missing something, i added html2canvas.js, jquery.plugin.html2canvas and using jquery 1.7. Your help is greatly appreciated. |
Are the images hosted under same origin as the page you are rendering? Set |
Images are loading perfect, please see logs below: html2canvas: Preload starts: finding background-images html2canvas.js:27 Unable to get image data from canvas because the canvas has been tainted by cross-origin data. html2canvas: Renderer: Canvas renderer done - returning canvas obj |
The javascript file and the image are located in the same directory addition to the previous comment. |
Hi niklasvh, it worked perfect its same original policy issue, i resolved running in websever previously running locally using file:// this is seen as a cross domain issue. Thanks for guiding me in the right direction. This is great plugin :) |
Niklashvh i'm trying to do this for android hybrid app, which runs locally using file:// can you guide me resolving this cross domain issue or any suggestions much appreciated. |
If you don't need to export the image anywhere, you can always set |
We are exporting image to memory and sending it as pdf in email |
I have the same problem, the log is as follows: html2canvas: Preload starts: finding html2canvas.js background-images: 21 the images are located in the background-image, just load the main image div, inmates are not shown. Not a problem because the images cross are in the same domain. Any idea? |
if I add "background-size: cover;" to the style, the image does not appear ... apparently this is the problem |
and it worked!!, only I have to put "background-size: 100% 100%;" instead of "background-size: cover;" |
HTML@Canvas don't capture when using online url with img, what is solution for this problem ? |
@Elgamal10 use proxy https://github.com/brcontainer/html2canvas-php-proxy (html2canvas proxy with php) Note: Read file README.md |
thanks for your reply , it's take screen shoot good but there is errors like: html2canvas_5 is not defined |
@Elgamal10 create an issue in the project I believe you use C# (ASP.NET), am I right? |
Hi Niklas , I have started using your api and it's great.. But i am stuck can you please help.. I am trying to convert an html to canvas using the code: Now i have a file called proxy.jsp that saves the all the cross origin images in the path ~/tomcat/myproject/images/" After that i see this in console After all this, my callback function is not executed and i cannot create a canvas.. What can be done? Can you please help? Many Thanks |
@himakshi89 you can not use the Prefer to use proxy. in your code has a comma left:
What version of your html2canvas? Try this: jQuery('body').html2canvas({
"onrendered": function(canvas) {
}
}); If not work try downloading the html2canvas this https://github.com/niklasvh/html2canvas/releases/download/0.4.1/html2canvas.js and use this code: html2canvas($("body").get(0), {
"logging": true,
"proxy": "http://localhost/myproject/proxy.jsp",
"onrendered": function(canvas) {
alert(canvas);
var url = canvas.toDataURL("image/png");
window.open(url, "_blank");
}
}); |
@brcontainer I have modified my code and now i am sending the response from proxy.jsp as No errors are shown in the console now. Please help |
But as the console can not show anything Try to provide your code online way to test. |
As suggested i removed the useCORS and replace html with body jQuery('body').html2canvas({ I am also receiving this is my console |
You tried download https://github.com/niklasvh/html2canvas/releases/download/0.4.1/html2canvas.js and this code: html2canvas($("body").get(0), {
"logging": true,
"proxy": "http://localhost/myproject/proxy.jsp",
"onrendered": function(canvas) {
alert(canvas);
var url = canvas.toDataURL("image/png");
window.open(url, "_blank");
}
}); or not? NOTE: |
I had downloaded the latest version I replace the code with the following html2canvas($("body").get(0), { |
send me the link test |
I am using this is chrome extension and the extension is still in development mode |
"Chrome extension" with JSP ? |
the jsp is being used only for the proxy part..According to you what is more preferable? |
Chrome-extension run in other "protocol" and "frame", proxy.jsp uses the HTTP protocol. I believe chrome-extensions do not require proxy. Use like: html2canvas($("body").get(0), {
"logging": true,
"onrendered": function(canvas) {
alert(canvas);
var url = canvas.toDataURL("image/png");
window.open(url, "_blank");
}
}); READ: http://developer.chrome.com/extensions/tut_debugging.html |
@brcontainer |
@jgab-net thank you so much. Searched way too long for the error |
@sumit8 (Y) you're welcome |
@usmonster by all means continue, saves me some time to look through each and every open issue :) |
Yes its resolved :) On Mon, Sep 1, 2014 at 4:11 AM, usmonster notifications@github.com wrote:
|
Im using the html2canvas - local image not rendering in pdf. whats the solution for this? |
@niklasvh pls help - the logo image in html is not rendering in pdf |
I failed when convert inline image.how to use "proxy": "http://localhost/myproject/proxy.jsp", I use vue ,where to put this jsp and i don't know how to use @niklasvh can you help? |
@qiuyaofan having same issue did you get the solution? I'm using it with angular2 and getting Images from Other Server. @gitbala did you get the solution? |
+1 BTW the logs looks good ( |
Im using allowTaint: true, |
@NikhilRadadiya @qiuyaofan guys, also been looking for a just client side solution. Using vue js and getting image from a giphy. So here is the one worked well for me:
So no proxy been used. |
@creepteed I have others element which I need to convert to canvas and then save to pdf, my html doesn't contain only images, if this is the case then how can I use above function you have posted? |
Hi @niklasvh , In console, I getting this |
Hi,
I tried to convert html to image using html2canvas, its working fine. But the image tag inside html elements is not converting, Given below one example:
## Working HTML ElementHere is my script for converting html2canvas:
var html2obj = html2canvas($('table'));
var queue = html2obj.parse();
var canvas = html2obj.render(queue);
var img = canvas.toDataURL();
$('#calendar_to_canvas').attr('src', img);
PFA screenshot
Thanks,
Bala
The text was updated successfully, but these errors were encountered: