Commit 300ede55adbafe0dca1301dafa76f690bf9c0d70
1 parent
515f0110
Print View Issue For Ipad
Showing
1 changed file
with
39 additions
and
28 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
@@ -627,7 +627,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | @@ -627,7 +627,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
627 | $rootScope.lexiconLanguageArray = []; | 627 | $rootScope.lexiconLanguageArray = []; |
628 | $rootScope.lexiconLanguageArray.push({ id: "1", language: "English" }); | 628 | $rootScope.lexiconLanguageArray.push({ id: "1", language: "English" }); |
629 | $(document).ready(function () { | 629 | $(document).ready(function () { |
630 | - | ||
631 | 630 | ||
632 | $rootScope.isLexiconTabClicked = true; | 631 | $rootScope.isLexiconTabClicked = true; |
633 | $rootScope.lexiconData = function () { | 632 | $rootScope.lexiconData = function () { |
@@ -4468,38 +4467,50 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | @@ -4468,38 +4467,50 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic | ||
4468 | }); | 4467 | }); |
4469 | 4468 | ||
4470 | function PrintDivContentByID(id) { | 4469 | function PrintDivContentByID(id) { |
4470 | + | ||
4471 | if (id == 'printBoxPor') { | 4471 | if (id == 'printBoxPor') { |
4472 | $("#printPSOptions").val("100%"); | 4472 | $("#printPSOptions").val("100%"); |
4473 | ResizeImage(1); | 4473 | ResizeImage(1); |
4474 | } | 4474 | } |
4475 | var contents = document.getElementById(id).innerHTML; | 4475 | var contents = document.getElementById(id).innerHTML; |
4476 | - | ||
4477 | - var frame1 = $('<iframe />'); | ||
4478 | - frame1[0].name = "frame1"; | ||
4479 | - frame1.css({ "position": "absolute", "top": "-1000000px" }); | ||
4480 | - $("body").append(frame1); | ||
4481 | - | ||
4482 | - var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument; | ||
4483 | - | ||
4484 | - frameDoc.document.open(); | ||
4485 | - //Create a new HTML document. | ||
4486 | - frameDoc.document.write('<html><head><title></title>');//Print Preview | ||
4487 | - frameDoc.document.write('</head><body>'); | ||
4488 | - //Append the external CSS file. | ||
4489 | - frameDoc.document.write('<link href="content/css/print-Portrait.css" rel="stylesheet" type="text/css" />'); | ||
4490 | - frameDoc.document.write('<link href="content/css/print-main.css" rel="stylesheet" type="text/css" />'); | ||
4491 | - //Append the DIV contents. | ||
4492 | - frameDoc.document.write(contents); | ||
4493 | - frameDoc.document.write('</body></html>'); | ||
4494 | - frameDoc.document.close(); | ||
4495 | - | ||
4496 | - setTimeout(function () { | ||
4497 | - window.frames["frame1"].focus(); | ||
4498 | - window.frames["frame1"].print(); | ||
4499 | - frame1.remove(); | ||
4500 | - }, 320); | ||
4501 | - | ||
4502 | - console.log('close') | 4476 | + // code for printng in ipads |
4477 | + var $ua = navigator.userAgent; | ||
4478 | + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { | ||
4479 | + $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>"); | ||
4480 | + html2canvas($("#canvasDiv"), { | ||
4481 | + onrendered: function (canvas) { | ||
4482 | + var imgsrc = canvas.toDataURL("image/png"); | ||
4483 | + var printContent = '<div id="img1"><img src="' + imgsrc + '" id="newimg1" style="margin:auto;top:0px;left:0px;right:0px;position:absolute;border:1px solid #ccc;" /></div>'; | ||
4484 | + var newPrintWindow = window.open(); | ||
4485 | + $(newPrintWindow.document.body).html(printContent); | ||
4486 | + newPrintWindow.print(); | ||
4487 | + } | ||
4488 | + }); | ||
4489 | + } | ||
4490 | + else { | ||
4491 | + var frame1 = $('<iframe />'); | ||
4492 | + frame1[0].name = "frame1"; | ||
4493 | + frame1.css({ "position": "absolute", "top": "-1000000px" }); | ||
4494 | + $("body").append(frame1); | ||
4495 | + var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument; | ||
4496 | + frameDoc.document.open(); | ||
4497 | + //Create a new HTML document. | ||
4498 | + frameDoc.document.write('<html><head><title></title>');//Print Preview | ||
4499 | + frameDoc.document.write('</head><body>'); | ||
4500 | + //Append the external CSS file. | ||
4501 | + frameDoc.document.write('<link href="content/css/print-Portrait.css" rel="stylesheet" type="text/css" />'); | ||
4502 | + frameDoc.document.write('<link href="content/css/print-main.css" rel="stylesheet" type="text/css" />'); | ||
4503 | + //Append the DIV contents. | ||
4504 | + frameDoc.document.write(contents); | ||
4505 | + frameDoc.document.write('</body></html>'); | ||
4506 | + frameDoc.document.close(); | ||
4507 | + setTimeout(function () { | ||
4508 | + window.frames["frame1"].focus(); | ||
4509 | + window.frames["frame1"].print(); | ||
4510 | + frame1.remove(); | ||
4511 | + }, 320); | ||
4512 | + } | ||
4513 | + console.log('close'); | ||
4503 | } | 4514 | } |
4504 | 4515 | ||
4505 | $(document).on('click', '#jsPanel-1 .jsglyph-remove', function () { | 4516 | $(document).on('click', '#jsPanel-1 .jsglyph-remove', function () { |