01944fc6 by Jeff Balicki

pdf.js working ie 10

1 parent 28355607
1 //var pluginUrl = window.location.protocol + '//' + window.location.host + '/commonwell'; 1 var pluginUrl = window.location.protocol + '//' + window.location.host + '/commonwell';
2 //var pdf_customizer = "http://localhost:8888/pdf-customizer/public"; 2 var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
3 3
4 4
5 var pluginUrl = window.location.protocol + '//' + window.location.host; 5 //var pluginUrl = window.location.protocol + '//' + window.location.host;
6 var pdf_customizer = "https://pdf-customizer.synapsus.co"; 6 //var pdf_customizer = "https://pdf-customizer.synapsus.co";
7 7
8 8
9 var imageHeight = ""; 9 var imageHeight = "";
...@@ -740,7 +740,7 @@ function finalPdf(data, json) { ...@@ -740,7 +740,7 @@ function finalPdf(data, json) {
740 740
741 var strVar2 = "" 741 var strVar2 = ""
742 742
743 strVar2 += '<div id="seepdf" style=" width:' + imageWidth + 'px; height: ' + imageHeight + 'px; overflow: hidden;" > <div id="page"><canvas id="the-canvas"></canvas></page></div>'; 743 strVar2 += '<div id="seepdf" style=" width:' + imageWidth + 'px; height: ' + imageHeight + 'px; overflow: hidden;" > <canvas id="the-canvas" width="' + imageWidth + '" height="' + imageHeight + '"></canvas></div>';
744 744
745 document.getElementById('pdfPreviewInner').innerHTML = strVar2; 745 document.getElementById('pdfPreviewInner').innerHTML = strVar2;
746 746
...@@ -761,10 +761,12 @@ PDFJS.getDocument(pfd_url) ...@@ -761,10 +761,12 @@ PDFJS.getDocument(pfd_url)
761 }) 761 })
762 .then(function(page) { 762 .then(function(page) {
763 // Set scale (zoom) level 763 // Set scale (zoom) level
764 var scale = 1.35; 764 var scale = 1;
765 765
766 // Get viewport (dimensions) 766 // Get viewport (dimensions)
767 var viewport = page.getViewport(scale); 767
768 //var viewport = page.getViewport(scale);
769
768 770
769 // Get canvas#the-canvas 771 // Get canvas#the-canvas
770 var canvas = document.getElementById('the-canvas'); 772 var canvas = document.getElementById('the-canvas');
...@@ -773,9 +775,10 @@ PDFJS.getDocument(pfd_url) ...@@ -773,9 +775,10 @@ PDFJS.getDocument(pfd_url)
773 var context = canvas.getContext('2d'); 775 var context = canvas.getContext('2d');
774 776
775 // Set dimensions to Canvas 777 // Set dimensions to Canvas
776 canvas.height = viewport.height; 778 canvas.height = imageHeight;
777 canvas.width = viewport.width; 779 canvas.width = imageWidth;
778 780
781 var viewport = page.getViewport(canvas.width / page.getViewport(1.0).width);
779 // Prepare object needed by render method 782 // Prepare object needed by render method
780 var renderContext = { 783 var renderContext = {
781 canvasContext: context, 784 canvasContext: context,
......