80d33c68 by Jeff Balicki

embed pdf

1 parent 39ca8fdb
var pluginUrl = window.location.protocol+'//'+window.location.host;
var pdf_customizer = "https://pdf-customizer.synapsus.co";
var pluginUrl = window.location.protocol+'//'+window.location.host+'/commonwell';
var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
//var pluginUrl = "http://contact.gotenzing.com";
//var pdf_customizer = "http://pdf-customizer.synapsus.co";
......@@ -65,7 +65,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
jQuery(document).ready(function($) {
$('span').hide();
$('#span' + count).show();
$('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")");
// $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' + example + ")");
var Qc = document.getElementById("Canvas");
var Qctx = Qc.getContext("2d");
......@@ -279,7 +279,7 @@ function changePdfOptions(json, edit) {
pdflist += '<div id="pdfPreview" style="" class="column">';
// pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">';
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>';
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>';
pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"></br><h4>' + json[0].name + '</h4>';
pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">';
for (i = 0; i < json.length; ++i) {
......@@ -629,7 +629,7 @@ function returnOptions(form, preview) {
var windowWidth = 0.90 * $(".layout-grid").width();
var windowHeight = 0.90 * $(".layout-grid").height();
......@@ -654,14 +654,15 @@ function returnOptions(form, preview) {
var imgLeft = 30;
var imgTop = 2;
}
// console.log(jsonReturn);
$("#Canvas").hide();
$('#changes').hide();
$('#controls').show();
$('#pdfPreviewInner').show();
......@@ -680,7 +681,7 @@ function returnOptions(form, preview) {
var strVar2 = ""
// strVar2 += ' <div class="callout primary"><div class="row column"><h1 class="pdfeditortitle">CUBOS COLLATERAL MATERIAL</h1>';
//strVar2 += '</div></div><div class="row small-up-2 medium-up-3 large-up-3">';
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>';
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>';
//<i class="fa fa-cloud-download fa-5x"></i></br>Download Here</a>
document.getElementById('pdfPreviewInner').innerHTML = strVar2;
......