Commit 543d23061646c770fca412f7e8a3444436d9a025

Authored by Amrita Vishnoi
2 parents 6b587817 300ede55

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

400-SOURCECODE/AIAHTML5.Web/app/controllers/HomeController.js
... ... @@ -628,7 +628,6 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
628 628 $rootScope.lexiconLanguageArray = [];
629 629 $rootScope.lexiconLanguageArray.push({ id: "1", language: "English" });
630 630 $(document).ready(function () {
631   -
632 631  
633 632 $rootScope.isLexiconTabClicked = true;
634 633 $rootScope.lexiconData = function () {
... ... @@ -4495,38 +4494,50 @@ function ($rootScope, Modules, $log, $location, $timeout, DataService, Authentic
4495 4494 });
4496 4495  
4497 4496 function PrintDivContentByID(id) {
  4497 +
4498 4498 if (id == 'printBoxPor') {
4499 4499 $("#printPSOptions").val("100%");
4500 4500 ResizeImage(1);
4501 4501 }
4502 4502 var contents = document.getElementById(id).innerHTML;
4503   -
4504   - var frame1 = $('<iframe />');
4505   - frame1[0].name = "frame1";
4506   - frame1.css({ "position": "absolute", "top": "-1000000px" });
4507   - $("body").append(frame1);
4508   -
4509   - var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument;
4510   -
4511   - frameDoc.document.open();
4512   - //Create a new HTML document.
4513   - frameDoc.document.write('<html><head><title></title>');//Print Preview
4514   - frameDoc.document.write('</head><body>');
4515   - //Append the external CSS file.
4516   - frameDoc.document.write('<link href="content/css/print-Portrait.css" rel="stylesheet" type="text/css" />');
4517   - frameDoc.document.write('<link href="content/css/print-main.css" rel="stylesheet" type="text/css" />');
4518   - //Append the DIV contents.
4519   - frameDoc.document.write(contents);
4520   - frameDoc.document.write('</body></html>');
4521   - frameDoc.document.close();
4522   -
4523   - setTimeout(function () {
4524   - window.frames["frame1"].focus();
4525   - window.frames["frame1"].print();
4526   - frame1.remove();
4527   - }, 320);
4528   -
4529   - console.log('close')
  4503 + // code for printng in ipads
  4504 + var $ua = navigator.userAgent;
  4505 + if (($ua.match(/(iPod|iPhone|iPad|android)/i))) {
  4506 + $("#canvasDiv").append("<img id='exportlogo' class='img-responsive' src='content/images/adam-logo-small.png'/>");
  4507 + html2canvas($("#canvasDiv"), {
  4508 + onrendered: function (canvas) {
  4509 + var imgsrc = canvas.toDataURL("image/png");
  4510 + 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>';
  4511 + var newPrintWindow = window.open();
  4512 + $(newPrintWindow.document.body).html(printContent);
  4513 + newPrintWindow.print();
  4514 + }
  4515 + });
  4516 + }
  4517 + else {
  4518 + var frame1 = $('<iframe />');
  4519 + frame1[0].name = "frame1";
  4520 + frame1.css({ "position": "absolute", "top": "-1000000px" });
  4521 + $("body").append(frame1);
  4522 + var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument;
  4523 + frameDoc.document.open();
  4524 + //Create a new HTML document.
  4525 + frameDoc.document.write('<html><head><title></title>');//Print Preview
  4526 + frameDoc.document.write('</head><body>');
  4527 + //Append the external CSS file.
  4528 + frameDoc.document.write('<link href="content/css/print-Portrait.css" rel="stylesheet" type="text/css" />');
  4529 + frameDoc.document.write('<link href="content/css/print-main.css" rel="stylesheet" type="text/css" />');
  4530 + //Append the DIV contents.
  4531 + frameDoc.document.write(contents);
  4532 + frameDoc.document.write('</body></html>');
  4533 + frameDoc.document.close();
  4534 + setTimeout(function () {
  4535 + window.frames["frame1"].focus();
  4536 + window.frames["frame1"].print();
  4537 + frame1.remove();
  4538 + }, 320);
  4539 + }
  4540 + console.log('close');
4530 4541 }
4531 4542  
4532 4543 $(document).on('click', '#jsPanel-1 .jsglyph-remove', function () {
... ...