wiziwig
Showing
19 changed files
with
260 additions
and
54 deletions
| ... | @@ -34,6 +34,9 @@ class PdfController extends Controller | ... | @@ -34,6 +34,9 @@ class PdfController extends Controller |
| 34 | $pdffile = $searchpath.'/'.$rows[0]->file; | 34 | $pdffile = $searchpath.'/'.$rows[0]->file; |
| 35 | //$outfile=""; | 35 | //$outfile=""; |
| 36 | $title = "Test Pages"; | 36 | $title = "Test Pages"; |
| 37 | $pageHeight = $rows[0]->pheight; | ||
| 38 | $pageWidth = $rows[0]->pwidth; | ||
| 39 | |||
| 37 | $storagePath = Storage::disk('public')->getDriver()->getAdapter()->getPathPrefix(); | 40 | $storagePath = Storage::disk('public')->getDriver()->getAdapter()->getPathPrefix(); |
| 38 | $outfile = $storagePath.$searchpath."/new_".$rows[0]->file; | 41 | $outfile = $storagePath.$searchpath."/new_".$rows[0]->file; |
| 39 | $download = 'http://localhost:8888/pdf-customizer/public/fileentry/getPDF/'.$searchpath."/new_".$rows[0]->file; | 42 | $download = 'http://localhost:8888/pdf-customizer/public/fileentry/getPDF/'.$searchpath."/new_".$rows[0]->file; |
| ... | @@ -81,7 +84,8 @@ try { | ... | @@ -81,7 +84,8 @@ try { |
| 81 | die("Error: " . $p->get_errmsg()); | 84 | die("Error: " . $p->get_errmsg()); |
| 82 | 85 | ||
| 83 | /* Dummy page size; will be adjusted later */ | 86 | /* Dummy page size; will be adjusted later */ |
| 84 | $p->begin_page_ext(10, 10, ""); | 87 | $p->begin_page_ext($pageWidth, $pageHeight , ""); |
| 88 | |||
| 85 | 89 | ||
| 86 | /* Place the imported page on the output page, and | 90 | /* Place the imported page on the output page, and |
| 87 | * adjust the page size */ | 91 | * adjust the page size */ |
| ... | @@ -93,11 +97,19 @@ try { | ... | @@ -93,11 +97,19 @@ try { |
| 93 | $pageNumber = $row->pages; | 97 | $pageNumber = $row->pages; |
| 94 | if($pageNumber == $pageno ) { | 98 | if($pageNumber == $pageno ) { |
| 95 | 99 | ||
| 96 | if ($row->change_type == 'text') { | 100 | if ($row->change_type == 'textflow') { |
| 97 | 101 | ||
| 98 | //Get font var from row | 102 | //Get font var from row |
| 99 | 103 | ||
| 100 | $textline = $row->content; | 104 | $textline = $row->content; |
| 105 | $textline = str_replace('<p>','<nextparagraph leading=100%>', $textline); | ||
| 106 | $textline = str_replace('</p>','', $textline); | ||
| 107 | $textline = str_replace('<br />','<nextline leading=80%>', $textline); | ||
| 108 | $textline = str_replace('<strong>','<fakebold=true>', $textline); | ||
| 109 | $textline = str_replace('</strong>','<fakebold=false>', $textline); | ||
| 110 | $textline = str_replace('<em>','<italicangle=-12>', $textline); | ||
| 111 | $textline = str_replace('</em>','<italicangle=0>', $textline); | ||
| 112 | $textline = str_replace('&','&', $textline); | ||
| 101 | $textLUp = $row->locationUp; | 113 | $textLUp = $row->locationUp; |
| 102 | $textwidth = $row->width; | 114 | $textwidth = $row->width; |
| 103 | $textheight = $row->height; | 115 | $textheight = $row->height; |
| ... | @@ -107,6 +119,7 @@ try { | ... | @@ -107,6 +119,7 @@ try { |
| 107 | $fontAlignment = $fontStyles["alignment"]; | 119 | $fontAlignment = $fontStyles["alignment"]; |
| 108 | $fontFamily = $fontStyles["font-family"]; | 120 | $fontFamily = $fontStyles["font-family"]; |
| 109 | $fontSize = $fontStyles["font-size"]; | 121 | $fontSize = $fontStyles["font-size"]; |
| 122 | |||
| 110 | if(isset($fontStyles["font-color"])) { | 123 | if(isset($fontStyles["font-color"])) { |
| 111 | $fontColor = $fontStyles["font-color"]; | 124 | $fontColor = $fontStyles["font-color"]; |
| 112 | }else{ | 125 | }else{ |
| ... | @@ -122,16 +135,55 @@ try { | ... | @@ -122,16 +135,55 @@ try { |
| 122 | die("Error: " . $p->get_errmsg()); | 135 | die("Error: " . $p->get_errmsg()); |
| 123 | } | 136 | } |
| 124 | $p->setfont($font, $fontSize); | 137 | $p->setfont($font, $fontSize); |
| 125 | $num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." }"; | 138 | $num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." } "; |
| 126 | 139 | ||
| 127 | 140 | ||
| 128 | $textline = $p->create_textflow($textline , $num_optlist); | 141 | $textline = $p->create_textflow($textline , $num_optlist); |
| 129 | $fit_optlist = "firstlinedist=capheight"; | 142 | $fit_optlist = "firstlinedist=capheight "; |
| 143 | |||
| 144 | |||
| 145 | $result = $p->fit_textflow($textline, $textLRight, $textLUp, ($textwidth + $textLRight) ,($textheight + $textLUp) ,$fit_optlist); | ||
| 146 | |||
| 147 | } else if ($row->change_type == 'text') { | ||
| 148 | $yoff = 50; | ||
| 149 | //Get font var from row | ||
| 150 | |||
| 151 | $textline = $row->content; | ||
| 152 | $textLUp = $row->locationUp; | ||
| 153 | $textwidth = $row->width; | ||
| 154 | $textheight = $row->height; | ||
| 155 | $textLRight = $row->locationRight; | ||
| 156 | $fontStyles = unserialize($row->style); | ||
| 157 | $fitmethod = $fontStyles["fitmethod"]; | ||
| 158 | |||
| 159 | $fontAlignment = $fontStyles["alignment"]; | ||
| 160 | $fontFamily = $fontStyles["font-family"]; | ||
| 161 | $fontSize = $fontStyles["font-size"]; | ||
| 162 | if(isset($fontStyles["font-color"])) { | ||
| 163 | $fontColor = $fontStyles["font-color"]; | ||
| 164 | }else{ | ||
| 165 | $fontColor = 'cmyk 0.75 0.68 0.67 0.90'; | ||
| 166 | |||
| 167 | } | ||
| 168 | /// Load and insert text and font | ||
| 169 | |||
| 170 | $p->set_option("FontOutline={" . $fontFamily . "=" . $storagePath . $folder . "/" . $fontFamily . ".otf}"); | ||
| 171 | /* For PDFlib Lite: change "unicode" to "winansi" */ | ||
| 172 | $font = $p->load_font($fontFamily, "unicode", "embedding"); | ||
| 173 | if ($font == 0) { | ||
| 174 | die("Error: " . $p->get_errmsg()); | ||
| 175 | } | ||
| 176 | $p->setfont($font, $fontSize); | ||
| 177 | //$num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." }"; | ||
| 178 | if($fitmethod == ''){$fitm =""; | ||
| 179 | }else{ $fitm = "fitmethod=".$fitmethod;} | ||
| 130 | 180 | ||
| 181 | $num_optlist = "fillcolor={".$fontColor." } position={".$fontAlignment."} boxsize={" . $textwidth." ".$textheight . "} fontsize=".$fontSize." ".$fitm. "showborder "; | ||
| 131 | 182 | ||
| 132 | $result = $p->fit_textflow($textline, $textLRight, $textLUp, $textwidth ,$textheight ,$fit_optlist); | 183 | $p->fit_textline($textline, $textLRight, $textLUp, $num_optlist); |
| 184 | } | ||
| 133 | 185 | ||
| 134 | } else if ($row->change_type == 'img') { | 186 | else if ($row->change_type == 'img') { |
| 135 | 187 | ||
| 136 | //Get image var from row | 188 | //Get image var from row |
| 137 | 189 | ||
| ... | @@ -140,9 +192,15 @@ try { | ... | @@ -140,9 +192,15 @@ try { |
| 140 | $imgLRight = $row->locationRight; | 192 | $imgLRight = $row->locationRight; |
| 141 | $bw = $row->width; | 193 | $bw = $row->width; |
| 142 | $bh = $row->height; | 194 | $bh = $row->height; |
| 195 | $ImageStyles = unserialize($row->style); | ||
| 196 | //var_dump($ImageStyles); | ||
| 197 | $ImagePosition = $ImageStyles["position"]; | ||
| 198 | $ImageFitmethod = $ImageStyles["fitmethod"]; | ||
| 199 | $ImageScale = $ImageStyles["scale"]; | ||
| 200 | $ImagesOrientate = $ImageStyles["orientate"]; | ||
| 143 | 201 | ||
| 144 | //Load and insert the images | 202 | //Load and insert the images |
| 145 | $buf = "boxsize={" . $bw . " " . $bh . "} position={center} fitmethod=meet"; | 203 | $buf = "boxsize={" . $bw . " " . $bh . "} position={".$ImagePosition."} scale=".$ImageScale." orientate=".$ImagesOrientate." fitmethod=".$ImageFitmethod." "; |
| 146 | $image = $p->load_image("auto", $storagePath . $imagefile, ""); | 204 | $image = $p->load_image("auto", $storagePath . $imagefile, ""); |
| 147 | if ($image == 0) { | 205 | if ($image == 0) { |
| 148 | die("Error: " . $p->get_errmsg()); | 206 | die("Error: " . $p->get_errmsg()); |
| ... | @@ -150,7 +208,45 @@ try { | ... | @@ -150,7 +208,45 @@ try { |
| 150 | $p->fit_image($image, $imgLRight, $imgLUp, $buf); | 208 | $p->fit_image($image, $imgLRight, $imgLUp, $buf); |
| 151 | 209 | ||
| 152 | 210 | ||
| 211 | }else if ($row->change_type == 'texthidden') { | ||
| 212 | $yoff = 50; | ||
| 213 | //Get font var from row | ||
| 214 | |||
| 215 | $textline = $row->content; | ||
| 216 | $textLUp = $row->locationUp; | ||
| 217 | $textwidth = $row->width; | ||
| 218 | $textheight = $row->height; | ||
| 219 | $textLRight = $row->locationRight; | ||
| 220 | $fontStyles = unserialize($row->style); | ||
| 221 | |||
| 222 | $fontAlignment = $fontStyles["alignment"]; | ||
| 223 | $fontFamily = $fontStyles["font-family"]; | ||
| 224 | $fontSize = $fontStyles["font-size"]; | ||
| 225 | $fitmethod = $fontStyles["fitmethod"]; | ||
| 226 | if(isset($fontStyles["font-color"])) { | ||
| 227 | $fontColor = $fontStyles["font-color"]; | ||
| 228 | }else{ | ||
| 229 | $fontColor = 'cmyk 0.75 0.68 0.67 0.90'; | ||
| 230 | |||
| 231 | } | ||
| 232 | /// Load and insert text and font | ||
| 233 | |||
| 234 | $p->set_option("FontOutline={" . $fontFamily . "=" . $storagePath . $folder . "/" . $fontFamily . ".otf}"); | ||
| 235 | /* For PDFlib Lite: change "unicode" to "winansi" */ | ||
| 236 | $font = $p->load_font($fontFamily, "unicode", "embedding"); | ||
| 237 | if ($font == 0) { | ||
| 238 | die("Error: " . $p->get_errmsg()); | ||
| 239 | } | ||
| 240 | $p->setfont($font, $fontSize); | ||
| 241 | //$num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." }"; | ||
| 242 | if($fitmethod == ''){$fitm =""; | ||
| 243 | }else{ $fitm = "fitmethod=".$fitmethod;} | ||
| 244 | |||
| 245 | $num_optlist = "fillcolor={".$fontColor." } position={".$fontAlignment."} fitmethod=".$fitmethod." boxsize={" . $textwidth." ".$textheight . "} fontsize=".$fontSize.""; | ||
| 246 | $p->setfont($font, $fontSize); | ||
| 247 | $p->fit_textline($textline, $textLRight, $textLUp, $num_optlist); | ||
| 153 | } | 248 | } |
| 249 | |||
| 154 | } | 250 | } |
| 155 | 251 | ||
| 156 | 252 | ... | ... |
| ... | @@ -119,7 +119,7 @@ class pdfModel extends Model | ... | @@ -119,7 +119,7 @@ class pdfModel extends Model |
| 119 | $fileName = explode('.', $fileName); | 119 | $fileName = explode('.', $fileName); |
| 120 | 120 | ||
| 121 | $pdfId = DB::table('PDF')->insertGetId( | 121 | $pdfId = DB::table('PDF')->insertGetId( |
| 122 | array('name' => $json->pdf[0]->name, 'folder' => $folder, 'file' => end($file), 'apiCallId' => $apiCallId, 'image'=> $fileName[0].'.jpg') | 122 | 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) |
| 123 | ); | 123 | ); |
| 124 | 124 | ||
| 125 | foreach($json->changes as $change) { | 125 | foreach($json->changes as $change) { | ... | ... |
121 KB
387 KB
No preview for this file type
151 KB
124 KB
130 KB
120 KB
No preview for this file type
No preview for this file type
No preview for this file type
260 KB
296 KB
No preview for this file type
592 KB
599 KB
| 1 | var pluginUrl = "http://localhost:8888/Forms"; | ||
| 2 | var pdf_customizer = "http://localhost:8888/pdf-customizer/public"; | ||
| 1 | 3 | ||
| 2 | 4 | // var pluginUrl = "http://contact.gotenzing.com"; | |
| 3 | // var pluginUrl = "http://localhost:8888/Forms"; | 5 | // var pdf_customizer = "http://pdf-customizer.synapsus.co"; |
| 4 | // var pdf_customizer = "http://localhost:8888/pdf-customizer/public"; | ||
| 5 | |||
| 6 | var pluginUrl = "http://contact.gotenzing.com"; | ||
| 7 | var pdf_customizer = "http://pdf-customizer.synapsus.co"; | ||
| 8 | 6 | ||
| 9 | function getAuth() { | 7 | function getAuth() { |
| 10 | 8 | ||
| ... | @@ -49,16 +47,15 @@ | ... | @@ -49,16 +47,15 @@ |
| 49 | 47 | ||
| 50 | 48 | ||
| 51 | 49 | ||
| 52 | |||
| 53 | function offFocus(id) { | 50 | function offFocus(id) { |
| 54 | 51 | ||
| 55 | 52 | ||
| 56 | jQuery(document).ready(function($) { | 53 | jQuery(document).ready(function($) { |
| 57 | 54 | ||
| 58 | 55 | ||
| 59 | $("#select"+id+"").removeClass("focus"); | 56 | $("#select" + id + "").removeClass("focus"); |
| 60 | $(".entry_block").mouseleave(function() { | 57 | $(".entry_block").mouseleave(function() { |
| 61 | $("#select"+id+"").addClass("focus"); | 58 | $("#select" + id + "").addClass("focus"); |
| 62 | }); | 59 | }); |
| 63 | 60 | ||
| 64 | 61 | ||
| ... | @@ -67,6 +64,61 @@ | ... | @@ -67,6 +64,61 @@ |
| 67 | }); | 64 | }); |
| 68 | } | 65 | } |
| 69 | 66 | ||
| 67 | function ShowBox(pheight, pwidth,up, right, height, width, example) { | ||
| 68 | |||
| 69 | |||
| 70 | jQuery(document).ready(function($) { | ||
| 71 | $('#Canvas').css("background-image", "url(" + pdf_customizer + '/fileentry/getImage/' +example+")"); | ||
| 72 | |||
| 73 | var Qc = document.getElementById("Canvas"); | ||
| 74 | var Qctx = Qc.getContext("2d"); | ||
| 75 | Qctx.clearRect(0, 0, Qc.width, Qc.height); | ||
| 76 | Qctx.restore(); | ||
| 77 | |||
| 78 | |||
| 79 | |||
| 80 | var down = pheight - (up + height); | ||
| 81 | var scaleH = $("Canvas").height() / pheight ; | ||
| 82 | var scaleW = $("Canvas").width() / pwidth ; | ||
| 83 | var scaleDown = down / scaleH; | ||
| 84 | var scaleRight = right/ scaleW; | ||
| 85 | var scalewidth = width / scaleW; | ||
| 86 | var scaleheight = height / scaleH; | ||
| 87 | |||
| 88 | var c = document.getElementById("Canvas"); | ||
| 89 | var ctx = c.getContext("2d"); | ||
| 90 | ctx.save(); | ||
| 91 | ctx.rect(scaleRight, scaleDown , scalewidth, scaleheight); | ||
| 92 | ctx.stroke(); | ||
| 93 | //console.log(pheight, pwidth,up, right, height, width); | ||
| 94 | // console.log(myrect ) | ||
| 95 | |||
| 96 | |||
| 97 | |||
| 98 | }); | ||
| 99 | |||
| 100 | } | ||
| 101 | |||
| 102 | |||
| 103 | function HideBox() { | ||
| 104 | |||
| 105 | |||
| 106 | jQuery(document).ready(function($) { | ||
| 107 | var cnv = document.getElementById("Canvas"); | ||
| 108 | var ctx = cnv.getContext('2d'); // gets reference to canvas context | ||
| 109 | ctx.beginPath(); // clear existing drawing paths | ||
| 110 | ctx.save(); // store the current transformation matrix | ||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | //console.log(0, 0, $("Canvas").width(), $("Canvas").height()); | ||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | }); | ||
| 120 | |||
| 121 | } | ||
| 70 | 122 | ||
| 71 | 123 | ||
| 72 | 124 | ||
| ... | @@ -115,16 +167,16 @@ | ... | @@ -115,16 +167,16 @@ |
| 115 | var i; | 167 | var i; |
| 116 | var pdflist = ""; | 168 | var pdflist = ""; |
| 117 | for (i = 0; i < json.length; ++i) { | 169 | for (i = 0; i < json.length; ++i) { |
| 118 | pdflist += "<div class=\"column\">"; | 170 | pdflist += '<div class="column">'; |
| 119 | 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>'; | 171 | 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>'; |
| 120 | pdflist += " <h5>" + json[i].name + "<\/h5>"; | 172 | pdflist += " <h5>" + json[i].name + "</h5>"; |
| 121 | pdflist += "<\/div>"; | 173 | pdflist += "</div>"; |
| 122 | } | 174 | } |
| 123 | 175 | ||
| 124 | 176 | ||
| 125 | strVar += " <div class=\"callout primary\"><div class=\"row column\"> <h1>Welcome to Synapsus Online PDF Editor<\/h1>"; | 177 | strVar += ' <div class="callout primary"><div class="row column"> <h1>Welcome to Synapsus Online PDF Editor</h1>'; |
| 126 | strVar += " <p class=\"lead\">Please pick a PDF<\/p> <\/div><\/div> <div class=\"row small-up-2 medium-up-3 large-up-4\">"; | 178 | strVar += ' <p class="lead">Please pick a PDF</p> </div></div> <div class="row small-up-2 medium-up-3 large-up-4/>'; |
| 127 | strVar += " <\/div>"; | 179 | strVar += ' </div>'; |
| 128 | 180 | ||
| 129 | 181 | ||
| 130 | 182 | ||
| ... | @@ -140,31 +192,40 @@ | ... | @@ -140,31 +192,40 @@ |
| 140 | function changePdfOptions(json) { | 192 | function changePdfOptions(json) { |
| 141 | json = JSON.parse(json); | 193 | json = JSON.parse(json); |
| 142 | 194 | ||
| 195 | |||
| 196 | |||
| 143 | var strVar2 = ""; | 197 | var strVar2 = ""; |
| 144 | 198 | ||
| 145 | 199 | ||
| 146 | var pdflist = ""; | 200 | var pdflist = ""; |
| 147 | var pdfChange = ""; | 201 | var pdfChange = ""; |
| 148 | pdflist += "<div class=\"column\">"; | 202 | var f = 0; |
| 149 | pdflist += ' <img src=\"' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].image + '\" width=\"300px\">'; | 203 | pdflist += '<div class="column" style="position: static; width: 212px; height: 10px; display: block; vertical-align: baseline; float: left;">'; |
| 150 | pdflist += "<\/div><br>"; | 204 | // pdflist += '<img id="pdfimage" src="' + pdf_customizer + '/fileentry/getImage/' + json[0].folder + '/' + json[0].example + '" width="300px">'; |
| 151 | pdfChange += "<form id=\"changes\" name=\"changes\" enctype=\"multipart/form-data\" action=\"#\" METHOD=\"POST\"><h4>" + json[0].name + "</h4>"; | 205 | 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>'; |
| 152 | pdfChange += " <input type=\"hidden\" id=\"id\" name=\"id\" value=\"" + json[0].idPDF + "\">"; | 206 | pdfChange += '<form id="changes" name="changes" enctype="multipart/form-data" action="#" METHOD="POST"><h4>' + json[0].name + '</h4>'; |
| 207 | pdfChange += '<input type="hidden" id="id" name="id" value="' + json[0].idPDF + '">'; | ||
| 153 | for (i = 0; i < json.length; ++i) { | 208 | for (i = 0; i < json.length; ++i) { |
| 209 | var example = json[0].folder + '/' +json[i].example | ||
| 210 | |||
| 211 | if (json[i].change_type == "textflow") { | ||
| 212 | 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>'; | ||
| 213 | ++f | ||
| 214 | } | ||
| 154 | if (json[i].change_type == "text") { | 215 | if (json[i].change_type == "text") { |
| 155 | pdfChange += " Text: <input id=\"content\" type=\"text\" name=\"content\" value=\"" + json[i].content + "\">"; | 216 | 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 + '"">'; |
| 156 | } | 217 | } |
| 157 | if (json[i].change_type == "img") { | 218 | if (json[i].change_type == "img") { |
| 158 | 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\" >"; | 219 | 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" >'; |
| 159 | } | 220 | } |
| 160 | } | 221 | } |
| 161 | pdfChange += " <input type=\"submit\" value=\"Submit\">"; | 222 | pdfChange += '<input type="submit" value="Submit">'; |
| 162 | pdfChange += "<\/form>"; | 223 | pdfChange += '</form>'; |
| 163 | 224 | ||
| 164 | strVar2 += " <div class=\"callout primary\"><div class=\"row column\"><h1>Welcome to Synapsus Online PDF Editor<\/h1>"; | 225 | strVar2 += ' <div class="callout primary"><div class="row column"><h1>Welcome to Synapsus Online PDF Editor</h1>'; |
| 165 | strVar2 += "<p class=\"lead\">Please make your changes or return <a href=\"#\" onclick=\"location.reload();\">back to the list</a><\/p>"; | 226 | strVar2 += '<p class="lead">Please make your changes or return <a href="#" onclick="location.reload();">back to the list</a></p>'; |
| 166 | strVar2 += " <\/div><\/div><div class=\"row small-up-2 medium-up-3 large-up-3\">"; | 227 | strVar2 += ' </div></div><div class="row small-up-2 medium-up-3 large-up-3">'; |
| 167 | strVar2 += pdflist + "<div class=\"column\">" + pdfChange + "<\/div><\/div>"; | 228 | 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>'; |
| 168 | 229 | ||
| 169 | 230 | ||
| 170 | 231 | ||
| ... | @@ -172,26 +233,72 @@ | ... | @@ -172,26 +233,72 @@ |
| 172 | document.getElementById('google_drive').innerHTML = " "; | 233 | document.getElementById('google_drive').innerHTML = " "; |
| 173 | 234 | ||
| 174 | jQuery(function($) { | 235 | jQuery(function($) { |
| 236 | |||
| 237 | |||
| 238 | |||
| 239 | $("#Canvas").stick_in_parent(); | ||
| 240 | |||
| 241 | |||
| 242 | |||
| 243 | |||
| 244 | |||
| 245 | |||
| 246 | |||
| 247 | tinymce.init({ | ||
| 248 | selector: '.textarea', | ||
| 249 | entity_encoding: "raw", | ||
| 250 | menubar: false, | ||
| 251 | toolbar: ' bold italic', | ||
| 252 | remove_linebreaks: false, | ||
| 253 | remove_trailing_brs: false, | ||
| 254 | setup: function(editor) { | ||
| 255 | editor.on('focus', function(e) { | ||
| 256 | console.log(editor.id); | ||
| 257 | $('#' + editor.id).trigger("onfocus"); | ||
| 258 | }); | ||
| 259 | editor.on('focusout', function(e) { | ||
| 260 | console.log('out'+editor.id); | ||
| 261 | HideBox(); | ||
| 262 | }); | ||
| 263 | } | ||
| 264 | |||
| 265 | |||
| 266 | |||
| 267 | }); | ||
| 268 | |||
| 175 | var files; | 269 | var files; |
| 270 | var imagefiles = [];; | ||
| 176 | 271 | ||
| 177 | // Add events | 272 | |
| 178 | $(".fileupload").change(function() { | 273 | $(".fileupload").change(function(e) { |
| 179 | files = event.target.files; | 274 | files = e.target.files; |
| 180 | console.log(files); | 275 | for (var i = 0, file; file = files[i]; i++) { |
| 276 | console.log(file); | ||
| 277 | imagefiles.push(file); | ||
| 278 | console.log(imagefiles); | ||
| 279 | } | ||
| 181 | }); | 280 | }); |
| 182 | 281 | ||
| 183 | 282 | ||
| 184 | $("#changes").submit(function(e) { | 283 | $("#changes").submit(function(e) { |
| 284 | $(tinymce.get()).each(function(i, el) { | ||
| 285 | |||
| 286 | if (el.id) | ||
| 287 | document.getElementById(el.id).value = el.getContent(); | ||
| 288 | console.log(el.id); | ||
| 289 | tinymce.get(el.id).remove(); | ||
| 290 | |||
| 291 | |||
| 292 | }); | ||
| 293 | |||
| 294 | |||
| 185 | e.preventDefault(); | 295 | e.preventDefault(); |
| 186 | 296 | ||
| 187 | var form = $("#changes"); | 297 | var form = $("#changes"); |
| 188 | // var values = {}; | ||
| 189 | //form.each(function() { | ||
| 190 | // values[this.name] = $(this).val(); | ||
| 191 | //}); | ||
| 192 | console.log(form); | ||
| 193 | 298 | ||
| 194 | returnfileOptions(files, form); | 299 | |
| 300 | |||
| 301 | returnfileOptions(imagefiles, form); | ||
| 195 | return false; | 302 | return false; |
| 196 | }); | 303 | }); |
| 197 | 304 | ||
| ... | @@ -199,7 +306,8 @@ | ... | @@ -199,7 +306,8 @@ |
| 199 | 306 | ||
| 200 | }); | 307 | }); |
| 201 | 308 | ||
| 202 | } | 309 | } |
| 310 | |||
| 203 | 311 | ||
| 204 | function returnfileOptions(files, form) { | 312 | function returnfileOptions(files, form) { |
| 205 | jQuery(function($) { | 313 | jQuery(function($) { |
| ... | @@ -207,6 +315,7 @@ | ... | @@ -207,6 +315,7 @@ |
| 207 | var data = new FormData(); | 315 | var data = new FormData(); |
| 208 | $.each(files, function(key, value) { | 316 | $.each(files, function(key, value) { |
| 209 | data.append(key, value); | 317 | data.append(key, value); |
| 318 | |||
| 210 | }); | 319 | }); |
| 211 | 320 | ||
| 212 | $.ajax({ | 321 | $.ajax({ |
| ... | @@ -240,7 +349,6 @@ | ... | @@ -240,7 +349,6 @@ |
| 240 | function returnOptions(form) { | 349 | function returnOptions(form) { |
| 241 | 350 | ||
| 242 | 351 | ||
| 243 | // console.log(form[0][1].value); | ||
| 244 | 352 | ||
| 245 | 353 | ||
| 246 | 354 | ||
| ... | @@ -253,7 +361,7 @@ | ... | @@ -253,7 +361,7 @@ |
| 253 | //console.log(json); | 361 | //console.log(json); |
| 254 | 362 | ||
| 255 | 363 | ||
| 256 | var jsonReturn = '{"pdf":[{"name":"' + json[0].name + '", "folder":"' + json[0].folder + '", "pdfLocation":"' + json[0].file + '"}],"changes":[' | 364 | var jsonReturn = '{"pdf":[{"name":"' + json[0].name + '", "folder":"' + json[0].folder + '", "pdfLocation":"' + json[0].file + '","pageWidth":"' + json[0].pageWidth + '","pageHeight":"' + json[0].pageHeight + '"}],"changes":[' |
| 257 | var e = 1; | 365 | var e = 1; |
| 258 | for (i = 0; i < json.length; ++i) { | 366 | for (i = 0; i < json.length; ++i) { |
| 259 | 367 | ||
| ... | @@ -261,6 +369,7 @@ | ... | @@ -261,6 +369,7 @@ |
| 261 | 369 | ||
| 262 | var style = JSON.stringify(json[i].style); | 370 | var style = JSON.stringify(json[i].style); |
| 263 | var content = JSON.stringify(form[0][e].value); | 371 | var content = JSON.stringify(form[0][e].value); |
| 372 | console.log(form[0][e].value); | ||
| 264 | 373 | ||
| 265 | 374 | ||
| 266 | 375 | ||
| ... | @@ -293,14 +402,15 @@ | ... | @@ -293,14 +402,15 @@ |
| 293 | 402 | ||
| 294 | async: true, | 403 | async: true, |
| 295 | success: function(data) { | 404 | success: function(data) { |
| 296 | var strVar2 ="" | 405 | var strVar2 = "" |
| 297 | strVar2 += " <div class=\"callout primary\"><div class=\"row column\"><h1>Welcome to Synapsus Online PDF Editor<\/h1>"; | 406 | strVar2 += " <div class=\"callout primary\"><div class=\"row column\"><h1>Welcome to Synapsus Online PDF Editor<\/h1>"; |
| 298 | strVar2 += "<p class=\"lead\">Please download your file below or return <a href=\"#\" onclick=\"location.reload();\">back to the list</a><\/p>"; | 407 | strVar2 += "<p class=\"lead\">Please download your file below or return <a href=\"#\" onclick=\"location.reload();\">back to the list</a><\/p>"; |
| 299 | strVar2 += " <\/div><\/div><div class=\"row small-up-2 medium-up-3 large-up-3\">"; | 408 | strVar2 += " <\/div><\/div><div class=\"row small-up-2 medium-up-3 large-up-3\">"; |
| 300 | 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>'; | 409 | 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>'; + |
| 301 | + "<\/div><\/div>"; | 410 | "<\/div><\/div>"; |
| 302 | 411 | ||
| 303 | document.getElementById('contentArea').innerHTML = strVar2 }, | 412 | document.getElementById('contentArea').innerHTML = strVar2 |
| 413 | }, | ||
| 304 | error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response | 414 | error: function(xhr, ajaxOptions, thrownError) { //Add these parameters to display the required response |
| 305 | alert(xhr.status); | 415 | alert(xhr.status); |
| 306 | document.getElementById('contentArea').innerHTML = xhr.responseText; | 416 | document.getElementById('contentArea').innerHTML = xhr.responseText; | ... | ... |
-
Please register or sign in to post a comment