Commit 3d6c5e13b70863ac8a83e2e13e43cb5002ad9b5f

Authored by Amrita Vishnoi
2 parents 390e9ada bd17f603

Merge branch 'ipadExportImageIssue' of http://52.6.196.163/ADAM/AIAHTML5 into Develop-IPAD-MAC

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