2adbdfda by Jeff Balicki

wiziwig

1 parent 76e79207
......@@ -34,6 +34,9 @@ class PdfController extends Controller
$pdffile = $searchpath.'/'.$rows[0]->file;
//$outfile="";
$title = "Test Pages";
$pageHeight = $rows[0]->pheight;
$pageWidth = $rows[0]->pwidth;
$storagePath = Storage::disk('public')->getDriver()->getAdapter()->getPathPrefix();
$outfile = $storagePath.$searchpath."/new_".$rows[0]->file;
$download = 'http://localhost:8888/pdf-customizer/public/fileentry/getPDF/'.$searchpath."/new_".$rows[0]->file;
......@@ -81,8 +84,9 @@ try {
die("Error: " . $p->get_errmsg());
/* Dummy page size; will be adjusted later */
$p->begin_page_ext(10, 10, "");
$p->begin_page_ext($pageWidth, $pageHeight , "");
/* Place the imported page on the output page, and
* adjust the page size */
......@@ -93,11 +97,19 @@ try {
$pageNumber = $row->pages;
if($pageNumber == $pageno ) {
if ($row->change_type == 'text') {
if ($row->change_type == 'textflow') {
//Get font var from row
$textline = $row->content;
$textline = str_replace('<p>','<nextparagraph leading=100%>', $textline);
$textline = str_replace('</p>','', $textline);
$textline = str_replace('<br />','<nextline leading=80%>', $textline);
$textline = str_replace('<strong>','<fakebold=true>', $textline);
$textline = str_replace('</strong>','<fakebold=false>', $textline);
$textline = str_replace('<em>','<italicangle=-12>', $textline);
$textline = str_replace('</em>','<italicangle=0>', $textline);
$textline = str_replace('&amp;','&', $textline);
$textLUp = $row->locationUp;
$textwidth = $row->width;
$textheight = $row->height;
......@@ -107,6 +119,7 @@ try {
$fontAlignment = $fontStyles["alignment"];
$fontFamily = $fontStyles["font-family"];
$fontSize = $fontStyles["font-size"];
if(isset($fontStyles["font-color"])) {
$fontColor = $fontStyles["font-color"];
}else{
......@@ -122,16 +135,55 @@ try {
die("Error: " . $p->get_errmsg());
}
$p->setfont($font, $fontSize);
$num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." }";
$num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." } ";
$textline = $p->create_textflow($textline , $num_optlist);
$fit_optlist = "firstlinedist=capheight";
$fit_optlist = "firstlinedist=capheight ";
$result = $p->fit_textflow($textline, $textLRight, $textLUp, $textwidth ,$textheight ,$fit_optlist);
$result = $p->fit_textflow($textline, $textLRight, $textLUp, ($textwidth + $textLRight) ,($textheight + $textLUp) ,$fit_optlist);
} else if ($row->change_type == 'img') {
} else if ($row->change_type == 'text') {
$yoff = 50;
//Get font var from row
$textline = $row->content;
$textLUp = $row->locationUp;
$textwidth = $row->width;
$textheight = $row->height;
$textLRight = $row->locationRight;
$fontStyles = unserialize($row->style);
$fitmethod = $fontStyles["fitmethod"];
$fontAlignment = $fontStyles["alignment"];
$fontFamily = $fontStyles["font-family"];
$fontSize = $fontStyles["font-size"];
if(isset($fontStyles["font-color"])) {
$fontColor = $fontStyles["font-color"];
}else{
$fontColor = 'cmyk 0.75 0.68 0.67 0.90';
}
/// Load and insert text and font
$p->set_option("FontOutline={" . $fontFamily . "=" . $storagePath . $folder . "/" . $fontFamily . ".otf}");
/* For PDFlib Lite: change "unicode" to "winansi" */
$font = $p->load_font($fontFamily, "unicode", "embedding");
if ($font == 0) {
die("Error: " . $p->get_errmsg());
}
$p->setfont($font, $fontSize);
//$num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." }";
if($fitmethod == ''){$fitm ="";
}else{ $fitm = "fitmethod=".$fitmethod;}
$num_optlist = "fillcolor={".$fontColor." } position={".$fontAlignment."} boxsize={" . $textwidth." ".$textheight . "} fontsize=".$fontSize." ".$fitm. "showborder ";
$p->fit_textline($textline, $textLRight, $textLUp, $num_optlist);
}
else if ($row->change_type == 'img') {
//Get image var from row
......@@ -140,9 +192,15 @@ try {
$imgLRight = $row->locationRight;
$bw = $row->width;
$bh = $row->height;
$ImageStyles = unserialize($row->style);
//var_dump($ImageStyles);
$ImagePosition = $ImageStyles["position"];
$ImageFitmethod = $ImageStyles["fitmethod"];
$ImageScale = $ImageStyles["scale"];
$ImagesOrientate = $ImageStyles["orientate"];
//Load and insert the images
$buf = "boxsize={" . $bw . " " . $bh . "} position={center} fitmethod=meet";
$buf = "boxsize={" . $bw . " " . $bh . "} position={".$ImagePosition."} scale=".$ImageScale." orientate=".$ImagesOrientate." fitmethod=".$ImageFitmethod." ";
$image = $p->load_image("auto", $storagePath . $imagefile, "");
if ($image == 0) {
die("Error: " . $p->get_errmsg());
......@@ -150,7 +208,45 @@ try {
$p->fit_image($image, $imgLRight, $imgLUp, $buf);
}
}else if ($row->change_type == 'texthidden') {
$yoff = 50;
//Get font var from row
$textline = $row->content;
$textLUp = $row->locationUp;
$textwidth = $row->width;
$textheight = $row->height;
$textLRight = $row->locationRight;
$fontStyles = unserialize($row->style);
$fontAlignment = $fontStyles["alignment"];
$fontFamily = $fontStyles["font-family"];
$fontSize = $fontStyles["font-size"];
$fitmethod = $fontStyles["fitmethod"];
if(isset($fontStyles["font-color"])) {
$fontColor = $fontStyles["font-color"];
}else{
$fontColor = 'cmyk 0.75 0.68 0.67 0.90';
}
/// Load and insert text and font
$p->set_option("FontOutline={" . $fontFamily . "=" . $storagePath . $folder . "/" . $fontFamily . ".otf}");
/* For PDFlib Lite: change "unicode" to "winansi" */
$font = $p->load_font($fontFamily, "unicode", "embedding");
if ($font == 0) {
die("Error: " . $p->get_errmsg());
}
$p->setfont($font, $fontSize);
//$num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." }";
if($fitmethod == ''){$fitm ="";
}else{ $fitm = "fitmethod=".$fitmethod;}
$num_optlist = "fillcolor={".$fontColor." } position={".$fontAlignment."} fitmethod=".$fitmethod." boxsize={" . $textwidth." ".$textheight . "} fontsize=".$fontSize."";
$p->setfont($font, $fontSize);
$p->fit_textline($textline, $textLRight, $textLUp, $num_optlist);
}
}
......
......@@ -119,7 +119,7 @@ class pdfModel extends Model
$fileName = explode('.', $fileName);
$pdfId = DB::table('PDF')->insertGetId(
array('name' => $json->pdf[0]->name, 'folder' => $folder, 'file' => end($file), 'apiCallId' => $apiCallId, 'image'=> $fileName[0].'.jpg')
array('name' => $json->pdf[0]->name, 'folder' => $folder, 'file' => end($file), 'apiCallId' => $apiCallId, 'image'=> $fileName[0].'.jpg','pheight' => $json->pdf[0]->pageHeight, 'pwidth' => $json->pdf[0]->pageWidth)
);
foreach($json->changes as $change) {
......
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 pluginUrl = "http://contact.gotenzing.com";
var pdf_customizer = "http://pdf-customizer.synapsus.co";
function getAuth() {
function getAuth() {
jQuery(document).ready(function($) {
jQuery(document).ready(function($) {
var settings = {
"async": true,
"crossDomain": true,
"url": "" + pdf_customizer + "/api/authenticate",
"method": "POST",
"processData": false,
"contentType": false,
"mimeType": "multipart/form-data",
"data": form,
"success": function(data) {
getJson(user_id);
},
error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
//alert(xhr.status);
document.getElementById('contentArea').innerHTML = xhr.responseText;
}
var settings = {
"async": true,
"crossDomain": true,
"url": "" + pdf_customizer + "/api/authenticate",
"method": "POST",
}
"processData": false,
"contentType": false,
"mimeType": "multipart/form-data",
"data": form,
"success": function(data) {
getJson(user_id);
},
error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
//alert(xhr.status);
document.getElementById('contentArea').innerHTML = xhr.responseText;
}
$.ajax(settings).done(function(response) {
console.log(response);
token = response;
}
$.ajax(settings).done(function(response) {
console.log(response);
token = response;
});
});
});
}
});
}
function offFocus(id) {
jQuery(document).ready(function($) {
$("#select" + id + "").removeClass("focus");
$(".entry_block").mouseleave(function() {
$("#select" + id + "").addClass("focus");
});
});
}
function ShowBox(pheight, pwidth,up, right, height, width, example) {
jQuery(document).ready(function($) {
$('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' +example+")");
function offFocus(id) {
var Qc = document.getElementById("Canvas");
var Qctx = Qc.getContext("2d");
Qctx.clearRect(0, 0, Qc.width, Qc.height);
Qctx.restore();
jQuery(document).ready(function($) {
$("#select"+id+"").removeClass("focus");
$(".entry_block").mouseleave(function() {
$("#select"+id+"").addClass("focus");
});
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 c = document.getElementById("Canvas");
var ctx = c.getContext("2d");
ctx.save();
ctx.rect(scaleRight, scaleDown , scalewidth, scaleheight);
ctx.stroke();
//console.log(pheight, pwidth,up, right, height, width);
// console.log(myrect )
});
}
function HideBox() {
jQuery(document).ready(function($) {
var cnv = document.getElementById("Canvas");
var ctx = cnv.getContext('2d'); // gets reference to canvas context
ctx.beginPath(); // clear existing drawing paths
ctx.save(); // store the current transformation matrix
});
}
//console.log(0, 0, $("Canvas").width(), $("Canvas").height());
});
}
function getJson(user_id) {
jQuery(document).ready(function($) {
$.getJSON("" + pdf_customizer + "/api/v1/get-list/" + user_id, function(data) {
// Get the element with id summary and set the inner text to the result.
var json = JSON.stringify(data);
pickPdfFromList(json);
function getJson(user_id) {
});
jQuery(document).ready(function($) {
$.getJSON("" + pdf_customizer + "/api/v1/get-list/" + user_id, function(data) {
// Get the element with id summary and set the inner text to the result.
var json = JSON.stringify(data);
pickPdfFromList(json);
});
});
}
function getOneJson(id) {
jQuery(document).ready(function($) {
});
}
$.getJSON("" + pdf_customizer + "/api/v1/get-pdf-google/" + id, function(data) {
// Get the element with id summary and set the inner text to the result.
var json = JSON.stringify(data);
function getOneJson(id) {
changePdfOptions(json);
jQuery(document).ready(function($) {
});
$.getJSON("" + pdf_customizer + "/api/v1/get-pdf-google/" + id, function(data) {
// Get the element with id summary and set the inner text to the result.
var json = JSON.stringify(data);
changePdfOptions(json);
});
});
}
function pickPdfFromList(json) {
json = JSON.parse(json);
});
}
function pickPdfFromList(json) {
json = JSON.parse(json);
var strVar = "";
var i;
var pdflist = "";
for (i = 0; i < json.length; ++i) {
pdflist += "<div class=\"column\">";
pdflist += '<a href=\"#\" onclick=\"getOneJson(' + json[i].idPDF + ');\"> <img class=\"thumbnail\" src="' + pdf_customizer + '/fileentry/getImage/' + json[i].folder + '/' + json[i].image + '" height=\"270px\"></a>';
pdflist += " <h5>" + json[i].name + "<\/h5>";
pdflist += "<\/div>";
}
var strVar = "";
strVar += " <div class=\"callout primary\"><div class=\"row column\"> <h1>Welcome to Synapsus Online PDF Editor<\/h1>";
strVar += " <p class=\"lead\">Please pick a PDF<\/p> <\/div><\/div> <div class=\"row small-up-2 medium-up-3 large-up-4\">";
strVar += " <\/div>";
var i;
var pdflist = "";
for (i = 0; i < json.length; ++i) {
pdflist += '<div class="column">';
pdflist += '<a href="#" onclick="getOneJson(' + json[i].idPDF + ');"> <img class="thumbnail" src="' + pdf_customizer + '/fileentry/getImage/' + json[i].folder + '/' + json[i].image + '" height="270px"></a>';
pdflist += " <h5>" + json[i].name + "</h5>";
pdflist += "</div>";
}
strVar += ' <div class="callout primary"><div class="row column"> <h1>Welcome to Synapsus Online PDF Editor</h1>';
strVar += ' <p class="lead">Please pick a PDF</p> </div></div> <div class="row small-up-2 medium-up-3 large-up-4/>';
strVar += ' </div>';
document.getElementById('contentArea').innerHTML = strVar;
document.getElementById('contentArea').innerHTML = strVar;
}
function changePdfOptions(json) {
json = JSON.parse(json);
}
var strVar2 = "";
function changePdfOptions(json) {
json = JSON.parse(json);
var pdflist = "";
var pdfChange = "";
pdflist += "<div class=\"column\">";
pdflist += ' <img src=\"' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].image + '\" width=\"300px\">';
pdflist += "<\/div><br>";
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) {
if (json[i].change_type == "text") {
pdfChange += " Text: <input id=\"content\" type=\"text\" name=\"content\" value=\"" + json[i].content + "\">";
}
if (json[i].change_type == "img") {
pdfChange += "Image: <input class=\"fileupload\" id=\"content\" style=\"display: block; box-sizing: border-box; width: 100%; height: 2.4375rem; padding: .5rem; border: 1px solid #cacaca; margin: 0 0 1rem; font-family: inherit; font-size: 1rem; color: #8a8a8a; background-color: #fefefe; box-shadow: inset 0 1px 2px rgba(10,10,10,.1); border-radius: 0; transition: box-shadow .5s,border-color .25s ease-in-out; -webkit-appearance: none; -moz-appearance: none;\" type=\"file\" name=\"content\" >";
}
var strVar2 = "";
var pdflist = "";
var pdfChange = "";
var f = 0;
pdflist += '<div class="column" style="position: static; width: 212px; height: 10px; display: block; vertical-align: baseline; float: left;">';
// 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; background-image: url(' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '); background-size:252px 504px;"></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) {
var example = json[0].folder + '/' +json[i].example
if (json[i].change_type == "textflow") {
pdfChange += json[i].names + ': <textarea onfocus="ShowBox('+json[0].pheight+','+json[0].pwidth+','+ json[i].locationUp+','+json[i].locationRight+','+json[i].height+','+json[i].width + ',\''+ example + '\')" title="' + json[i].names + '" id="changescontent'+[f]+'" class="textarea" value="' + json[i].content + '" name="content">' + json[i].content + '</textarea>';
++f
}
if (json[i].change_type == "text") {
pdfChange += json[i].names + ': <input onfocusout="HideBox()" onfocus="ShowBox('+json[0].pheight+','+json[0].pwidth+','+ json[i].locationUp+','+json[i].locationRight+','+json[i].height+','+json[i].width +',\''+ example + '\')" title="' + json[i].names + '" id="changescontent" type="text" name="content" value="' + json[i].content + '"">';
}
if (json[i].change_type == "img") {
pdfChange += json[i].names + ': <input onfocusout="HideBox()" onfocus="ShowBox('+json[0].pheight+','+json[0].pwidth+','+ json[i].locationUp+','+json[i].locationRight+','+json[i].height+','+json[i].width + ',\''+ example + '\')" title="' + json[i].names + '" class="fileupload" id="changescontent" style="display: block; box-sizing: border-box; width: 100%; height: 2.4375rem; padding: .5rem; border: 1px solid #cacaca; margin: 0 0 1rem; font-family: inherit; font-size: 1rem; color: #8a8a8a; background-color: #fefefe; box-shadow: inset 0 1px 2px rgba(10,10,10,.1); border-radius: 0; transition: box-shadow .5s,border-color .25s ease-in-out; -webkit-appearance: none; -moz-appearance: none;" type="file" name="content" >';
}
}
pdfChange += '<input type="submit" value="Submit">';
pdfChange += '</form>';
strVar2 += ' <div class="callout primary"><div class="row column"><h1>Welcome to Synapsus Online PDF Editor</h1>';
strVar2 += '<p class="lead">Please make your changes or return <a href="#" onclick="location.reload();">back to the list</a></p>';
strVar2 += ' </div></div><div class="row small-up-2 medium-up-3 large-up-3">';
strVar2 += pdflist + '<div class="column" style="margin-left:300px; width:300px;">' + pdfChange + '</div></div><div style="height: 200px; margin-top: 50px;padding: 10px;position: relative;"></div>';
document.getElementById('contentArea').innerHTML = strVar2;
document.getElementById('google_drive').innerHTML = " ";
jQuery(function($) {
$("#Canvas").stick_in_parent();
tinymce.init({
selector: '.textarea',
entity_encoding: "raw",
menubar: false,
toolbar: ' bold italic',
remove_linebreaks: false,
remove_trailing_brs: false,
setup: function(editor) {
editor.on('focus', function(e) {
console.log(editor.id);
$('#' + editor.id).trigger("onfocus");
});
editor.on('focusout', function(e) {
console.log('out'+editor.id);
HideBox();
});
}
pdfChange += " <input type=\"submit\" value=\"Submit\">";
pdfChange += "<\/form>";
strVar2 += " <div class=\"callout primary\"><div class=\"row column\"><h1>Welcome to Synapsus Online PDF Editor<\/h1>";
strVar2 += "<p class=\"lead\">Please make your changes or return <a href=\"#\" onclick=\"location.reload();\">back to the list</a><\/p>";
strVar2 += " <\/div><\/div><div class=\"row small-up-2 medium-up-3 large-up-3\">";
strVar2 += pdflist + "<div class=\"column\">" + pdfChange + "<\/div><\/div>";
});
var files;
var imagefiles = [];;
document.getElementById('contentArea').innerHTML = strVar2;
document.getElementById('google_drive').innerHTML = " ";
$(".fileupload").change(function(e) {
files = e.target.files;
for (var i = 0, file; file = files[i]; i++) {
console.log(file);
imagefiles.push(file);
console.log(imagefiles);
}
});
jQuery(function($) {
var files;
// Add events
$(".fileupload").change(function() {
files = event.target.files;
console.log(files);
});
$("#changes").submit(function(e) {
$(tinymce.get()).each(function(i, el) {
if (el.id)
document.getElementById(el.id).value = el.getContent();
console.log(el.id);
tinymce.get(el.id).remove();
$("#changes").submit(function(e) {
e.preventDefault();
var form = $("#changes");
// var values = {};
//form.each(function() {
// values[this.name] = $(this).val();
//});
console.log(form);
});
returnfileOptions(files, form);
return false;
});
e.preventDefault();
var form = $("#changes");
});
}
function returnfileOptions(files, form) {
jQuery(function($) {
returnfileOptions(imagefiles, form);
return false;
});
var data = new FormData();
$.each(files, function(key, value) {
data.append(key, value);
});
$.ajax({
url: '' + pluginUrl + '/wp-content/plugins/pdf-customizer-plugin/admin/uploadfile.php?files',
type: 'POST',
data: data,
cache: false,
dataType: 'json',
processData: false, // Don't process the files
contentType: false, // Set content type to false as jQuery will tell the server its a query string request
success: function(data, textStatus, jqXHR) {
if (typeof data.error === 'undefined') {
returnOptions(form);
} else {
// Handle errors here
console.log('ERRORS: ' + data.error);
}
},
error: function(jqXHR, textStatus, errorThrown) {
// Handle errors here
console.log('ERRORS: ' + textStatus);
// STOP LOADING SPINNER
}
});
});
});
}
}
function returnfileOptions(files, form) {
jQuery(function($) {
function returnOptions(form) {
var data = new FormData();
$.each(files, function(key, value) {
data.append(key, value);
});
// console.log(form[0][1].value);
$.ajax({
url: '' + pluginUrl + '/wp-content/plugins/pdf-customizer-plugin/admin/uploadfile.php?files',
type: 'POST',
data: data,
cache: false,
dataType: 'json',
processData: false, // Don't process the files
contentType: false, // Set content type to false as jQuery will tell the server its a query string request
success: function(data, textStatus, jqXHR) {
if (typeof data.error === 'undefined') {
returnOptions(form);
} else {
// Handle errors here
console.log('ERRORS: ' + data.error);
}
},
error: function(jqXHR, textStatus, errorThrown) {
// Handle errors here
console.log('ERRORS: ' + textStatus);
// STOP LOADING SPINNER
}
});
});
}
function returnOptions(form) {
jQuery(function($) {
jQuery(function($) {
$.getJSON("" + pdf_customizer + "/api/v1/get-pdf/" + id.value, function(dataReturnd) {
// Get the element with id summary and set the inner text to the result.
var json = dataReturnd;
//console.log(json);
$.getJSON("" + pdf_customizer + "/api/v1/get-pdf/" + id.value, function(dataReturnd) {
// Get the element with id summary and set the inner text to the result.
var json = dataReturnd;
//console.log(json);
var jsonReturn = '{"pdf":[{"name":"' + json[0].name + '", "folder":"' + json[0].folder + '", "pdfLocation":"' + json[0].file + '"}],"changes":['
var e = 1;
for (i = 0; i < json.length; ++i) {
var jsonReturn = '{"pdf":[{"name":"' + json[0].name + '", "folder":"' + json[0].folder + '", "pdfLocation":"' + json[0].file + '","pageWidth":"' + json[0].pageWidth + '","pageHeight":"' + json[0].pageHeight + '"}],"changes":['
var e = 1;
for (i = 0; i < json.length; ++i) {
var style = JSON.stringify(json[i].style);
var content = JSON.stringify(form[0][e].value);
var style = JSON.stringify(json[i].style);
var content = JSON.stringify(form[0][e].value);
console.log(form[0][e].value);
jsonReturn += '{"label":"' + json[i].label + '", "locationUp":"' + json[i].locationUp + '", "locationRight":"' + json[i].locationRight + '","width":"' + json[i].width + '","height":"' + json[i].height + '", "pages":"' + json[i].pages + '", "content":' + content + ', "z-index":null, "idstylesPDF":"' + json[i].idstylesPDF + '", "style":' + style + ', "order":"' + json[i].order + '", "idchange_typePDF":"' + json[i].idchange_typePDF + '", "change_type":"' + json[i].change_type + '", "fileLocation":"' + pluginUrl + '/wp-content/plugins/pdf-customizer-plugin/admin/images"}';
jsonReturn += '{"label":"' + json[i].label + '", "locationUp":"' + json[i].locationUp + '", "locationRight":"' + json[i].locationRight + '","width":"' + json[i].width + '","height":"' + json[i].height + '", "pages":"' + json[i].pages + '", "content":' + content + ', "z-index":null, "idstylesPDF":"' + json[i].idstylesPDF + '", "style":' + style + ', "order":"' + json[i].order + '", "idchange_typePDF":"' + json[i].idchange_typePDF + '", "change_type":"' + json[i].change_type + '", "fileLocation":"' + pluginUrl + '/wp-content/plugins/pdf-customizer-plugin/admin/images"}';
if (i < json.length - 1) {
jsonReturn += ',';
}
++e
}
jsonReturn += ' ]}';
// console.log(jsonReturn);
if (i < json.length - 1) {
jsonReturn += ',';
}
++e
}
jsonReturn += ' ]}';
// console.log(jsonReturn);
$.ajax({
url: "" + pdf_customizer + "/api/update",
type: "POST",
dataType: 'json',
data: jsonReturn,
processData: false,
$.ajax({
url: "" + pdf_customizer + "/api/update",
type: "POST",
dataType: 'json',
data: jsonReturn,
processData: false,
contentType: "application/json",
CrossDomain: true,
contentType: "application/json",
CrossDomain: true,
async: true,
success: function(data) {
var strVar2 =""
strVar2 += " <div class=\"callout primary\"><div class=\"row column\"><h1>Welcome to Synapsus Online PDF Editor<\/h1>";
strVar2 += "<p class=\"lead\">Please download your file below or return <a href=\"#\" onclick=\"location.reload();\">back to the list</a><\/p>";
strVar2 += " <\/div><\/div><div class=\"row small-up-2 medium-up-3 large-up-3\">";
strVar2 += "<div class=\"column\">" + '<a href="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '" download="' + json[0].file + '" ><i class="fa fa-cloud-download fa-5x"></i></br>Download Here</a>';
+ "<\/div><\/div>";
async: true,
success: function(data) {
var strVar2 = ""
strVar2 += " <div class=\"callout primary\"><div class=\"row column\"><h1>Welcome to Synapsus Online PDF Editor<\/h1>";
strVar2 += "<p class=\"lead\">Please download your file below or return <a href=\"#\" onclick=\"location.reload();\">back to the list</a><\/p>";
strVar2 += " <\/div><\/div><div class=\"row small-up-2 medium-up-3 large-up-3\">";
strVar2 += "<div class=\"column\">" + '<a href="' + pdf_customizer + '/fileentry/getPDF/' + json[0].folder + '/new_' + json[0].file + '" download="' + json[0].file + '" ><i class="fa fa-cloud-download fa-5x"></i></br>Download Here</a>'; +
"<\/div><\/div>";
document.getElementById('contentArea').innerHTML = strVar2 },
error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
alert(xhr.status);
document.getElementById('contentArea').innerHTML = xhr.responseText;
}
document.getElementById('contentArea').innerHTML = strVar2
},
error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response
alert(xhr.status);
document.getElementById('contentArea').innerHTML = xhr.responseText;
}
});
});
});
});
});
});
}
\ No newline at end of file
}
\ No newline at end of file
......