80fc1b5b by Jeff Balicki

added pdf

1 parent ddcd7cb7
This file is too large to display.
No preview for this file type
This diff could not be displayed because it is too large.
// var pluginUrl = "http://localhost:8888/Forms";
// var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
// var pluginUrl = "http://localhost:8888/Forms";
// var pdf_customizer = "http://localhost:8888/pdf-customizer/public";
var pluginUrl = "http://contact.gotenzing.com";
var pdf_customizer = "http://pdf-customizer.synapsus.co";
var pdf_customizer = "http://pdf-customizer.synapsus.co";
function getAuth() {
......@@ -82,15 +82,17 @@
var down = pheight - (up + height);
var scaleH = $("Canvas").height() / pheight ;
var scaleW = $("Canvas").width() / pwidth ;
var scaleDown = down / scaleH;
var scaleRight = right/ scaleW;
var scalewidth = width / scaleW;
var scaleheight = height / scaleH;
var scaleDown = down * scaleH;
var scaleRight = right* scaleW;
var scalewidth = width * scaleW;
var scaleheight = height * scaleH;
var c = document.getElementById("Canvas");
var ctx = c.getContext("2d");
ctx.save();
ctx.rect(scaleRight, scaleDown , scalewidth, scaleheight);
console.log(scaleRight, scaleDown , scalewidth, scaleheight);
console.log($("Canvas").height(), $("Canvas").width(), scaleW, scaleH);
ctx.stroke();
//console.log(pheight, pwidth,up, right, height, width);
// console.log(myrect )
......@@ -202,9 +204,20 @@
var pdflist = "";
var pdfChange = "";
var f = 0;
if(json[0].pwidth > '300'){
var scaleImage = 300 / json[0].pwidth;
var imageHeight = json[0].pheight * scaleImage;
var imageWidth = '300';
console.log(json[0].pheight , scaleImage, imageHeight);
}else{
var imageWidth = json[0].pwidth;
var imageHeight = json[0].pheight;
console.log(json[0].pheight , scaleImage);
}
pdflist += '<div id="pdfPreview" class="column">';
// pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">';
pdflist += '<canvas id="Canvas" width="252px" height="504px" style=" margin-top:60px; border-style: solid; border-width:1px; background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:252px 504px;"></div>';
pdflist += '<canvas id="Canvas" width="'+imageWidth+'" height="'+imageHeight+'" style=" margin-top:60px; 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"></div>';
pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="" METHOD="POST"><h4>' + json[0].name + '</h4>';
pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">';
for (i = 0; i < json.length; ++i) {
......