Search Results

Search found 5 results on 1 pages for 'html2canvas'.

Page 1/1 | 1 

  • Html2Canvas ...Google Map is not rendering

    - by eric maxfield
    I am running a Apache Server . I have a simple screen capture set up using Html2canvas .The capture function is rendering a blank Image . I have tried numerous ways to configure the javascript using related articles from this site to no Avail . The code is all working and tested because I can capture the image prior to "google maps api being loaded . Thank you and any advice would be much appreciated . <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <head> <title>Tester</title> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="html2canvas.js"></script> <script type="text/javascript" src="jquery.plugin.html2canvas.js"></script> <script src="http://www.google.com/jsapi?key=ABQIAAAAwbkbZLyhsmTCWXbTcjbgbRSzHs7K5SvaUdm8ua-Xxy_-2dYwMxQMhnagaawTo7L1FE1-amhuQxIlXw"></script> <script> google.load("earth", "1"); var ge = null; function init() { google.earth.createInstance("map_canvas", initCallback, failureCallback); } function initCallback(object) { ge = object; ge.getWindow().setVisibility(true); } function failureCallback(object) { } function capture() { $('#target').html2canvas({ onrendered: function (canvas) { //Set hidden field's value to image data (base-64 string) $('#img_val').val(canvas.toDataURL("image/png")); //Submit the form manually document.getElementById("myForm").submit(); } }); } </script> <style type="text/css"> #map_canvas {position: fixed; top: 60px; left: 0px; right:0px; bottom:0px; } #target { border: 1px solid #CCC; margin: 0px; padding:0px; position: absolute; left: 10px;top: 80px;height: 580px; width: 580px; } </style> </head> <body onload='init()' id='body'> <form method="POST" enctype="multipart/form-data" action="save.php" id="myForm"> <input type="hidden" name="img_val" id="img_val" value="" /> </form> <input type="submit" value="Take Screenshot Of Div Below" onclick="capture();" /> <div id="target"> <div id="map_canvas"> </div> </div> </body> </html> This is the php document renders to save.php <?php //Get the base-64 string from data $filteredData=substr($_POST['img_val'], strpos($_POST['img_val'], ",")+1); //Decode the string $unencodedData=base64_decode($filteredData); //Save the image file_put_contents('img.png', $unencodedData); ?> <h2>Save the image and show to user</h2> <table> <tr> <td> <a href="img.png" target="blank"> Click Here to See The Image Saved to Server</a> </td> <td align="right"> <a href="index.php"> Click Here to Go Back</a> </td> </tr> <tr> <td colspan="2"> <br /> <br /> <span> Here is Client-sided image: </span> <br /> <?php //Show the image echo '<img src="'.$_POST['img_val'].'" />'; ?> </td> </tr> </table> <style type="text/css"> body, a, span { font-family: Tahoma; font-size: 10pt; font-weight: bold; } </style> This sample works Correctly . I want to achieve this with above Code using "Google Earth" <!DOCTYPE html> <html> <head> <script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js"></script> <script type="text/javascript" src ="http://code.jquery.com/jquery-1.9.0.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script type="text/javascript" src="html2canvas.js"></script> <script type="text/javascript" src="jquery.plugin.html2canvas.js"></script> </script> <script type="text/javascript"> function initialize() { var mapProp = { center:new google.maps.LatLng(51.508742,-0.120850), zoom:5, mapTypeId:google.maps.MapTypeId.ROADMAP }; var map=new google.maps.Map(document.getElementById("googleMap"), mapProp); } google.maps.event.addDomListener(window, 'load', initialize); $(window).load(function(){ $('#load').click(function(){ html2canvas($('#googleMap'), { useCORS: true, onrendered: function (canvas) { var dataUrl= canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); window.location.href = dataUrl; } }); }); }); </script> </head> <body> <div id="googleMap" style="width:500px;height:380px;"></div> <input type="button" value="Save" id="load"/> </body> </html>

    Read the article

  • How to use html2canvas JavaScript with Selenium webdriver in C#

    - by PapyRef
    With selenium webdriver, I would test html2canvas JS script to take "screenshots" of webpages or parts of it, directly on the browser. I have a written this C# code to test it, but obj is always null. C# Code for reference IWebDriver Driver = new FirefoxDriver(); Driver.Navigate().GoToUrl("http://www.monsite.com"); string scriptJS = File.ReadAllText("html2canvas.js"); scriptJS += @" html2canvas(document.body, { onrendered: function(canvas) { var img = canvas.toDataURL("image/png"); return img; } });"; IJavaScriptExecutor executorJS = Driver as IJavaScriptExecutor; var obj = executorJS.ExecuteScript(scriptJS);

    Read the article

  • How to store result of drag and drop as a image

    - by Jimmy
    I want to take the screenshot of the result of drag and drop, but I don't know how to do. Actually, I found 2 javascript and using HTML5 such as html2canvas and canvas2image. I am now combining them together, but it's still meet some problem with the canvas2image. Please help me solve this problem if you have same experience, thank you a lot. Please help me, I've been stock here for days. Drag and drop code. <script> $(function() { $( "#draggable" ).draggable(); $( "#draggable2" ).draggable(); $( "#droppable" ).droppable({ hoverClass: "ui-state-active", drop: function( event, ui ) { $( this ) .addClass( "ui-state-highlight" ) .find( "p" ) .html( "Dropped!" ); } }); }); </script> Image generation code <script> window.onload = function() { function convertCanvas(strType) { if (strType == "JPEG") var oImg = Canvas2Image.saveAsJPEG(oCanvas, true); if (!oImg) { alert("Sorry, this browser is not capable of saving " + strType + " files!"); return false; } oImg.id = "canvasimage"; oImg.style.border = oCanvas.style.border; oCanvas.parentNode.replaceChild(oImg, oCanvas); } function convertHtml(strType) { $('body').html2canvas(); var queue = html2canvas.Parse(); var canvas = html2canvas.Renderer(queue,{elements:{length:1}}); var img = canvas.toDataURL(); convertCanvas(strType); window.open(img); } document.getElementById("html2canvasbtn").onclick = function() { convertHtml("JPEG"); } } </script> HTML code <body> <h3>Picture:</h3> <div id="draggable"> <img src='http://1.gravatar.com/avatar/1ea64135b09e00ab80fa7596fafbd340? s=50&d=identicon&r=R'> </div> <div id="draggable2"> <img src='http://0.gravatar.com/avatar/2647a7d4b4a7052d66d524701432273b?s=50&d=identicon&r=G'> </div> <div id="dCanvas"> <canvas id="droppable" width="500" height="500" style="border: 2px solid gray" class="ui-widget-header" /> </div> <input type="button" id="bGenImage" value="Generate Image" /> <div id="dOutput"></div> </body>

    Read the article

  • Screenshot IE7 Javascript

    - by boje
    I have tried but i can get this to work with IE7 or Firefox 5.0. I know that google.com/plus have a nice feedback that works in IE7. http://html2canvas.hertzen.com/screenshots.html Is is using canvas but i have but plugins in all. I get a error i first line of this code: var preload = html2canvas.Preload(body, { "complete": function (images) { var queue = html2canvas.Parse(body, images); var canvas = $(html2canvas.Renderer(queue)); var finishTime = new Date(); $("#content").empty().append(canvas); // throwMessage('Screenshot created in '+ ((finishTime.getTime()-timer)/1000) + " seconds<br />",4000); } }); So if you have a zip file with a example that are working in IE7 or a example i will be more then happy.

    Read the article

  • Taking web page screen shot in Windows 8 Metro app

    - by Megan
    I'm trying to take screen shot of web page in Windows 8 Metro app. So far the only helpful control is the WebView. Unfortunately it does not contain any method like DrawToBitmap (known from Forms WebBrowser control). Am I missing something? Different approach would focus on injecting some JS (e.g. html2canvas) to page rendered in WebView but I don't think it is possible due to security reasons. I would greatly appreciate any help.

    Read the article

1