2b8466b5 by Jeff Balicki

e

1 parent fe35443e
...@@ -32,8 +32,11 @@ class ApiController extends Controller ...@@ -32,8 +32,11 @@ class ApiController extends Controller
32 { 32 {
33 33
34 34
35 $json = '{"pdf":[{"name":"Sample PDF Document","folder":"Sample","pdfLocation":"http://hotelpodlipou.sk/uploads/files/sample.pdf"}],"changes":[{"label":"none","locationUp":"400","locationRight":90,"pages":"1","content":"logo-sample-text_355-558.jpg","z-index":null,"idstylesPDF":1,"order":"2","style":null,"idchange_typePDF":2,"change_type":"2","fileLocation":"https://image.freepik.com/free-vector/logo-sample-text_355-558.jpg"},{"label":"text style","locationUp":"60","locationRight":290,"pages":"1","content":"519.642.4404 London","z-index":null,"idstylesPDF":2,"order":"1","style":"a:3:{s:11:\"font-family\";s:11:\"TradeGothic\";s:9:\"font-size\";s:2:\"14\";s:10:\"font-color\";s:16:\"cmyk 0 0.6 0.5 0\";}","idchange_typePDF":1,"change_type":"1"}]}'; 35 // $json = '{"pdf":[{"name":"Sample PDF Document","folder":"Sample","pdfLocation":"http://hotelpodlipou.sk/uploads/files/sample.pdf"}],"changes":[{"label":"none","locationUp":"400","locationRight":90,"pages":"1","content":"logo-sample-text_355-558.jpg","z-index":null,"idstylesPDF":1,"order":"2","style":null,"idchange_typePDF":2,"change_type":"2","fileLocation":"https://image.freepik.com/free-vector/logo-sample-text_355-558.jpg"},{"label":"text style","locationUp":"60","locationRight":290,"pages":"1","content":"519.642.4404 London","z-index":null,"idstylesPDF":2,"order":"1","style":"a:3:{s:11:\"font-family\";s:11:\"TradeGothic\";s:9:\"font-size\";s:2:\"14\";s:10:\"font-color\";s:16:\"cmyk 0 0.6 0.5 0\";}","idchange_typePDF":1,"change_type":"1"}]}';
36 36
37 //$styles = serialize(array("font-family"=>"Barber","font-size"=>"20","font-color"=>"cmyk 0 0 0 0","alignment"=>"left"));
38 //print_r($styles);
39 //die();
37 $apiCallId = new pdfModel(); 40 $apiCallId = new pdfModel();
38 $apiCallId = $apiCallId->addApiCall('1',$json); 41 $apiCallId = $apiCallId->addApiCall('1',$json);
39 //$apiCallId = "3"; 42 //$apiCallId = "3";
......
...@@ -99,10 +99,13 @@ try { ...@@ -99,10 +99,13 @@ try {
99 99
100 $textline = $row->content; 100 $textline = $row->content;
101 $textLUp = $row->locationUp; 101 $textLUp = $row->locationUp;
102 $textwidth = $row->width;
103 $textheight = $row->height;
102 $textLRight = $row->locationRight; 104 $textLRight = $row->locationRight;
103 $fontStyles = unserialize($row->style); 105 $fontStyles = unserialize($row->style);
104 106
105 $fontFamily = $fontStyles["font-family"]; 107 $fontAlignment = $fontStyles["alignment"];
108 $fontFamily = $fontStyles["font-family"];
106 $fontSize = $fontStyles["font-size"]; 109 $fontSize = $fontStyles["font-size"];
107 if(isset($fontStyles["font-color"])) { 110 if(isset($fontStyles["font-color"])) {
108 $fontColor = $fontStyles["font-color"]; 111 $fontColor = $fontStyles["font-color"];
...@@ -119,12 +122,14 @@ try { ...@@ -119,12 +122,14 @@ try {
119 die("Error: " . $p->get_errmsg()); 122 die("Error: " . $p->get_errmsg());
120 } 123 }
121 $p->setfont($font, $fontSize); 124 $p->setfont($font, $fontSize);
122 $num_optlist = "fillcolor={".$fontColor." }"; 125 $num_optlist = "fontname=".$fontFamily." fontsize=".$fontSize." encoding=unicode alignment=".$fontAlignment." fillcolor={".$fontColor." }";
126
127
123 $textline = $p->create_textflow($textline , $num_optlist); 128 $textline = $p->create_textflow($textline , $num_optlist);
124 $fit_optlist = "firstlinedist=capheight"; 129 $fit_optlist = "firstlinedist=capheight";
125 130
126 131
127 $result = $p->fit_textflow($textline, $textLRight, $textLUp, 190,120 ,$fit_optlist); 132 $result = $p->fit_textflow($textline, $textLRight, $textLUp, $textwidth ,$textheight ,$fit_optlist);
128 133
129 } else if ($row->change_type == 'img') { 134 } else if ($row->change_type == 'img') {
130 135
......
...@@ -80,7 +80,7 @@ class pdfModel extends Model ...@@ -80,7 +80,7 @@ class pdfModel extends Model
80 ); 80 );
81 81
82 $idchangesPDF = DB::table('changesPDF')->insertGetId( 82 $idchangesPDF = DB::table('changesPDF')->insertGetId(
83 array('PDF_idPDF' => $pdfId, 'change_typePDF_idchange_typePDF' => $change->change_type, 'stylesPDF_idstylesPDF' => $idstylesPDF, 'locationUp' => $change->locationUp, 'locationRight' => $change->locationRight, 'pages' => $change->pages, 'content' => $change->content, 'z-index' => '') 83 array('PDF_idPDF' => $pdfId, 'change_typePDF_idchange_typePDF' => $change->change_type, 'stylesPDF_idstylesPDF' => $idstylesPDF, 'locationUp' => $change->locationUp, 'locationRight' => $change->locationRight, 'width' => $change->width, 'height' => $change->height, 'pages' => $change->pages, 'content' => $change->content, 'z-index' => '')
84 ); 84 );
85 85
86 } 86 }
...@@ -124,7 +124,7 @@ class pdfModel extends Model ...@@ -124,7 +124,7 @@ class pdfModel extends Model
124 ); 124 );
125 125
126 $idchangesPDF = DB::table('changesPDF')->insertGetId( 126 $idchangesPDF = DB::table('changesPDF')->insertGetId(
127 array('PDF_idPDF' => $pdfId, 'change_typePDF_idchange_typePDF' => $change->idchange_typePDF, 'stylesPDF_idstylesPDF' => $idstylesPDF, 'locationUp' => $change->locationUp, 'locationRight' => $change->locationRight, 'pages' => $change->pages, 'content' => $content, 'z-index' => '') 127 array('PDF_idPDF' => $pdfId, 'change_typePDF_idchange_typePDF' => $change->idchange_typePDF, 'stylesPDF_idstylesPDF' => $idstylesPDF, 'locationUp' => $change->locationUp, 'locationRight' => $change->locationRight, 'width' => $change->width, 'height' => $change->height, 'pages' => $change->pages, 'content' => $content, 'z-index' => '')
128 ); 128 );
129 129
130 } 130 }
......
No preview for this file type
No preview for this file type
No preview for this file type