Commit 8d4080cb04dc1b8377273ff02508c9b0a0a3e6d4

Authored by unknown
1 parent f632c046

Export Image Functionality in Ipad

400-SOURCECODE/AIAHTML5.Web/index.html
... ... @@ -1343,9 +1343,7 @@
1343 1343 </div>
1344 1344 </div>
1345 1345 <script>
1346   -
1347 1346 function enableDisableFillOption() {
1348   - //debugger;
1349 1347 if (document.getElementById('fill-option').checked) {
1350 1348 // $('#imgOpacity').attr("background-color");
1351 1349 //$('#imgOpacity').css({"background-color"})
... ... @@ -1592,8 +1590,6 @@
1592 1590 else {
1593 1591 $("#text_area").css("font-style", "normal");
1594 1592 }
1595   -
1596   -
1597 1593 });
1598 1594  
1599 1595 $("#text-underline").on('click', function () {
... ... @@ -1939,21 +1935,38 @@
1939 1935 <script>
1940 1936 $(function () {
1941 1937 $("#btnSaveEI").click(function () {
1942   - $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
1943   - html2canvas($("#canvasDiv"), {
1944   - onrendered: function (canvas) {
1945   - theCanvas = canvas;
1946   - var fileName = document.getElementById("filename").value + '.jpg';
1947   - if (typeof (fileName) == "undefined" || fileName == ".jpg")
1948   - fileName = "Untitled.jpg"
1949   - var dataURL = canvas.toDataURL("image/jpeg");
1950   - var blob = dataURItoBlob(dataURL);
1951   - saveAs(blob, fileName);
1952   - $("#exportlogo").remove();
1953   - $("#filename").val("");
1954   - }
1955   - });
1956   - $(".export-image").css("display", "none");
  1938 + var $ua = navigator.userAgent;
  1939 + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {
  1940 + $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
  1941 + html2canvas($("#canvasDiv"), {
  1942 + onrendered: function (canvas) {
  1943 + var imgsrc = canvas.toDataURL("image/png");
  1944 + console.log(imgsrc);
  1945 + var html = '<div id="img"><img src="' + imgsrc + '" id="newimg" style="margin:auto;top:0px;left:0px;right:0px;position:absolute;border:1px solid #ccc;" /></div>';
  1946 + var w = window.open();
  1947 + $(w.document.body).html(html);
  1948 + $("#filename").val("");
  1949 + }
  1950 + });
  1951 + }
  1952 + else {
  1953 + $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
  1954 + html2canvas($("#canvasDiv"), {
  1955 + onrendered: function (canvas) {
  1956 + theCanvas = canvas;
  1957 + var fileName = document.getElementById("filename").value + '.jpg';
  1958 + if (typeof (fileName) == "undefined" || fileName == ".jpg")
  1959 + fileName = "Untitled.jpg"
  1960 + var dataURL = canvas.toDataURL("image/jpeg");
  1961 + var blob = dataURItoBlob(dataURL);
  1962 + console.log(blob);
  1963 + saveAs(blob, fileName);
  1964 + $("#exportlogo").remove();
  1965 + $("#filename").val("");
  1966 + }
  1967 + });
  1968 + $(".export-image").css("display", "none");
  1969 + }
1957 1970 });
1958 1971 });
1959 1972 function dataURItoBlob(dataURI) {
... ...