80d33c68 by Jeff Balicki

embed pdf

1 parent 39ca8fdb
1 var pluginUrl = window.location.protocol+'//'+window.location.host; 1 var pluginUrl = window.location.protocol+'//'+window.location.host+'/commonwell';
2 var pdf_customizer = "https://pdf-customizer.synapsus.co"; 2 var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
3 3
4 //var pluginUrl = "http://contact.gotenzing.com"; 4 //var pluginUrl = "http://contact.gotenzing.com";
5 //var pdf_customizer = "http://pdf-customizer.synapsus.co"; 5 //var pdf_customizer = "http://pdf-customizer.synapsus.co";
...@@ -65,7 +65,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) { ...@@ -65,7 +65,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
65 jQuery(document).ready(function($) { 65 jQuery(document).ready(function($) {
66 $('span').hide(); 66 $('span').hide();
67 $('#span' + count).show(); 67 $('#span' + count).show();
68 $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")"); 68 // $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")");
69 69
70 var Qc = document.getElementById("Canvas"); 70 var Qc = document.getElementById("Canvas");
71 var Qctx = Qc.getContext("2d"); 71 var Qctx = Qc.getContext("2d");
...@@ -279,7 +279,7 @@ function changePdfOptions(json, edit) { ...@@ -279,7 +279,7 @@ function changePdfOptions(json, edit) {
279 279
280 pdflist += '<div id="pdfPreview" style="" class="column">'; 280 pdflist += '<div id="pdfPreview" style="" class="column">';
281 // pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">'; 281 // pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">';
282 pdflist += '<canvas id="Canvas" width="' + imageWidth + '" height="' + imageHeight + '" style=" margin-top:'+imgTop+'%; display: block; margin-left: auto; margin-right: auto; border-style: solid; border-width:1px; background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:' + imageWidth + 'px ' + imageHeight + 'px"></canvas><div id="pdfPreviewInner"></div></div>'; 282 pdflist += '<canvas id="Canvas" width="' + imageWidth + '" height="' + imageHeight + '" style=" margin-top:'+imgTop+'%; display: block; margin-left: auto; margin-right: auto; border-style: solid; border-width:1px; background-size:' + imageWidth + 'px ' + imageHeight + 'px"></canvas><div id="pdfPreviewInner"></div></div>';
283 pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>'; 283 pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>';
284 pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">'; 284 pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">';
285 for (i = 0; i < json.length; ++i) { 285 for (i = 0; i < json.length; ++i) {
...@@ -629,7 +629,7 @@ function returnOptions(form, preview) { ...@@ -629,7 +629,7 @@ function returnOptions(form, preview) {
629 629
630 630
631 631
632 632
633 var windowWidth = 0.90 * $(".layout-grid").width(); 633 var windowWidth = 0.90 * $(".layout-grid").width();
634 var windowHeight = 0.90 * $(".layout-grid").height(); 634 var windowHeight = 0.90 * $(".layout-grid").height();
635 635
...@@ -654,14 +654,15 @@ function returnOptions(form, preview) { ...@@ -654,14 +654,15 @@ function returnOptions(form, preview) {
654 var imgLeft = 30; 654 var imgLeft = 30;
655 var imgTop = 2; 655 var imgTop = 2;
656 } 656 }
657
658 // console.log(jsonReturn); 657 // console.log(jsonReturn);
659 658
660 659
661 660
662 661
663 $("#Canvas").hide(); 662 $("#Canvas").hide();
663 $('#changes').hide();
664 $('#controls').show(); 664 $('#controls').show();
665
665 $('#pdfPreviewInner').show(); 666 $('#pdfPreviewInner').show();
666 667
667 668
...@@ -680,7 +681,7 @@ function returnOptions(form, preview) { ...@@ -680,7 +681,7 @@ function returnOptions(form, preview) {
680 var strVar2 = "" 681 var strVar2 = ""
681 // strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>'; 682 // strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>';
682 //strVar2 += '</div></div><div class="row small-up-2 medium-up-3 large-up-3">'; 683 //strVar2 += '</div></div><div class="row small-up-2 medium-up-3 large-up-3">';
683 strVar2 += '<div id="seepdf" style=" display:hidden; width:'+imageWidth+'px;" ><a class="media" style="display: block; margin-left:auto; margin-right:auto; " href="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '" download="' + json[0].file + '" ></a></div>'; 684 strVar2 += '<div id="seepdf" style=" display:hidden; width:'+imageWidth+'px;" ><embed src="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '#page=1&toolbar=0&navpanes=0&scrollbar=0statusbar=0" width="'+imageWidth+'" height="'+imageHeight+'" type="application/pdf"></div>';
684 //<i class="fa fa-cloud-download fa-5x"></i></br>Download Here</a> 685 //<i class="fa fa-cloud-download fa-5x"></i></br>Download Here</a>
685 686
686 document.getElementById('pdfPreviewInner').innerHTML = strVar2; 687 document.getElementById('pdfPreviewInner').innerHTML = strVar2;
......