-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest-case.py
60 lines (59 loc) · 2.17 KB
/
test-case.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!C:\\Python27\\python.exe
print "Content-Type: text/html\r\n"
print """<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>html2canvas python proxy</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.min.js"></script>
<style>
#box {
width: 410px;
background: #c0c0c0;
}
#box p {
padding: 5px;
}
</style>
<script>
//<![CDATA[
(function() {
window.onload = function(){
html2canvas(document.body, {
"logging": true, //Enable log (use Web Console for get Errors and Warnings)
"proxy":"proxy.py",
"onrendered": function(canvas) {
var img = new Image();
img.onload = function() {
img.onload = null;
document.body.appendChild(img);
};
img.onerror = function() {
img.onerror = null;
if(window.console.log) {
window.console.log("Not loaded image from canvas.toDataURL");
} else {
alert("Not loaded image from canvas.toDataURL");
}
};
img.src = canvas.toDataURL("image/png");
}
});
};
})();
//]]>
</script>
</head>
<body>
<div id="box">
<p>
<img alt="google maps static" src="http://maps.googleapis.com/maps/api/staticmap?center=40.714728,-73.998672&zoom=12&size=400x300&maptype=roadmap&sensor=false">
<br>
<img alt="facebook image redirect" src="https://graph.facebook.com/100007213599954/picture">
<br>
<img alt="bmp test" src="http://caio.ueberalles.net/img.old/modules/imagemagick/data/test.bmp">
</p>
</div>
</body>
</html>
"""