diff --git a/.gitignore b/.gitignore index 5665749f..666d1ca0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,8 +2,9 @@ api/application/vendor/* api/application/logs/* api/application/syslogs/* +api/application/docs/* !api/application/logs/index.html !api/application/logs/.htaccess !api/application/syslogs/index.html !api/application/syslogs/.htaccess -!api/application/docs/* + diff --git a/api/application/composer.json b/api/application/composer.json index 6938f88b..275403d9 100644 --- a/api/application/composer.json +++ b/api/application/composer.json @@ -18,7 +18,7 @@ "ddeboer/tesseract": "^1.1", "aws/aws-sdk-php": "^3.64", "amphp/amp": "^1.2", - "dompdf/dompdf" : "0.6.*", + "dompdf/dompdf" : "0.8.2", "tecnickcom/tcpdf": "^6.2" }, diff --git a/api/application/composer.lock b/api/application/composer.lock index ba5a94ac..c3f2dc96 100644 --- a/api/application/composer.lock +++ b/api/application/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5c78e1c8273b1893de422b5c5c44d72f", + "content-hash": "3c701de93cab2666e738c9d504ee46b0", "packages": [ { "name": "amphp/amp", @@ -192,30 +192,47 @@ }, { "name": "dompdf/dompdf", - "version": "v0.6.2", + "version": "v0.8.2", "source": { "type": "git", "url": "https://github.com/dompdf/dompdf.git", - "reference": "cc06008f75262510ee135b8cbb14e333a309f651" + "reference": "5113accd9ae5d466077cce5208dcf3fb871bf8f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/cc06008f75262510ee135b8cbb14e333a309f651", - "reference": "cc06008f75262510ee135b8cbb14e333a309f651", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/5113accd9ae5d466077cce5208dcf3fb871bf8f6", + "reference": "5113accd9ae5d466077cce5208dcf3fb871bf8f6", "shasum": "" }, "require": { - "phenx/php-font-lib": "0.2.*" + "ext-dom": "*", + "ext-gd": "*", + "ext-mbstring": "*", + "phenx/php-font-lib": "0.5.*", + "phenx/php-svg-lib": "0.3.*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.7-dev" + } + }, "autoload": { + "psr-4": { + "Dompdf\\": "src/" + }, "classmap": [ - "include/" + "lib/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL" + "LGPL-2.1" ], "authors": [ { @@ -225,11 +242,15 @@ { "name": "Brian Sweeney", "email": "eclecticgeek@gmail.com" + }, + { + "name": "Gabriel Bull", + "email": "me@gabrielbull.com" } ], "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", "homepage": "https://github.com/dompdf/dompdf", - "time": "2015-12-07T04:07:13+00:00" + "time": "2017-11-26T14:49:08+00:00" }, { "name": "guzzlehttp/guzzle", @@ -549,27 +570,30 @@ }, { "name": "phenx/php-font-lib", - "version": "0.2.2", + "version": "0.5.1", "source": { "type": "git", "url": "https://github.com/PhenX/php-font-lib.git", - "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82" + "reference": "760148820110a1ae0936e5cc35851e25a938bc97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", - "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", + "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/760148820110a1ae0936e5cc35851e25a938bc97", + "reference": "760148820110a1ae0936e5cc35851e25a938bc97", "shasum": "" }, + "require-dev": { + "phpunit/phpunit": "^4.8" + }, "type": "library", "autoload": { - "classmap": [ - "classes/" - ] + "psr-4": { + "FontLib\\": "src/FontLib" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL" + "LGPL-3.0" ], "authors": [ { @@ -579,7 +603,47 @@ ], "description": "A library to read, parse, export and make subsets of different types of font files.", "homepage": "https://github.com/PhenX/php-font-lib", - "time": "2014-02-01T15:22:28+00:00" + "time": "2017-09-13T16:14:37+00:00" + }, + { + "name": "phenx/php-svg-lib", + "version": "v0.3.2", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-svg-lib.git", + "reference": "ccc46ef6340d4b8a4a68047e68d8501ea961442c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/ccc46ef6340d4b8a4a68047e68d8501ea961442c", + "reference": "ccc46ef6340d4b8a4a68047e68d8501ea961442c", + "shasum": "" + }, + "require": { + "sabberworm/php-css-parser": "8.1.*" + }, + "require-dev": { + "phpunit/phpunit": "~5.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Svg\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse and export to PDF SVG files.", + "homepage": "https://github.com/PhenX/php-svg-lib", + "time": "2018-06-03T10:10:03+00:00" }, { "name": "psr/http-message", @@ -718,6 +782,50 @@ "description": "A polyfill for getallheaders.", "time": "2016-02-11T07:05:27+00:00" }, + { + "name": "sabberworm/php-css-parser", + "version": "8.1.0", + "source": { + "type": "git", + "url": "https://github.com/sabberworm/PHP-CSS-Parser.git", + "reference": "850cbbcbe7fbb155387a151ea562897a67e242ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/850cbbcbe7fbb155387a151ea562897a67e242ef", + "reference": "850cbbcbe7fbb155387a151ea562897a67e242ef", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "type": "library", + "autoload": { + "psr-0": { + "Sabberworm\\CSS": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Raphael Schweikert" + } + ], + "description": "Parser for CSS Files written in PHP", + "homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "keywords": [ + "css", + "parser", + "stylesheet" + ], + "time": "2016-07-19T19:14:21+00:00" + }, { "name": "smalot/pdfparser", "version": "v0.13.2", diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index bff80a1b..f60e4b7b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -3197,18 +3197,87 @@ class PD_Controller extends REST_Controller { array('name' => 'Selvi','age' => '60','relation'=>'Mother','es'=>'Housewife','cn'=>'-'), ); $t = $this->load->view('report_templates/SALCASH',$data,true); - print_r($t); + //print_r($t); //PDF Gen using DOM PDF //$pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF //PDF GEN BY TCPDF + + // create new PDF document + $pdf = new TCPDF(); + + // set document information + // $pdf->SetCreator(PDF_CREATOR); + // $pdf->SetAuthor('SineEdge'); + // $pdf->SetTitle($data['main_applicant_name']); + // $pdf->SetSubject('PD Report of '.$data['main_applicant_name']); + // $pdf->SetKeywords('SineEdge, PD Report'); + + // set default header data + // $pdf->SetHeaderData("C:\Users\VELZ\Desktop\sineedge_red.png", PDF_HEADER_LOGO_WIDTH, $data['main_applicant_name'], "Custom Header", array(0,64,255), array(0,64,128)); + // $pdf->setFooterData(array(0,64,0), array(0,64,128)); + + // set header and footer fonts + // $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); + // $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); + + // set default monospaced font + //$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); + + // set margins + // $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); + // $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); + // $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); + + // set auto page breaks + //$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); + + // set image scale factor + //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); + + // set some language-dependent strings (optional) + if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { + require_once(dirname(__FILE__).'/lang/eng.php'); + $pdf->setLanguageArray($l); + } + + // --------------------------------------------------------- + + // set default font subsetting mode + //$pdf->setFontSubsetting(true); + + // Set font + // dejavusans is a UTF-8 Unicode font, if you only need to + // print standard ASCII chars, you can use core fonts like + // helvetica or times to reduce file size. + //$pdf->SetFont('dejavusans', '', 10, '', true); + + // Add a page + // This method has several options, check the source code documentation for more information. + $pdf->AddPage(); + + // set text shadow effect + //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal')); + + // Set some content to print + $html = $t; + + //Print text using writeHTMLCell() + $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); + + // --------------------------------------------------------- + + // Close and output PDF document + // This method has several options, check the source code documentation for more information. + $pdf->Output(APPPATH."/docs/sample.pdf", 'F'); + //PDF GEN BY TCPDF - + die(); $output_file2 = APPPATH."/docs/sample.pdf"; - echo file_put_contents($output_file2, $pdf_doc); + echo file_put_contents($output_file2, $pdf->Output(APPPATH."/docs/sample.pdf", 'F')); // echo $ci_instant; } diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index e69de29b..d5d51359 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/authorization_helper.php b/api/application/helpers/authorization_helper.php index a7b3a350..096b26a4 100644 --- a/api/application/helpers/authorization_helper.php +++ b/api/application/helpers/authorization_helper.php @@ -65,9 +65,17 @@ class AUTHORIZATION echo json_encode($response); exit; } - else if($headersData['mode'] == '0777') + else if(isset($headersData['mode'])) { - return true; + if($headersData['mode'] == '0777') + { + return true; + } + else + { + $validateToken = self::validateTimestamp(); + return $validateToken; + } } else if($routingName!=ROUTE_LOGIN){ $validateToken = self::validateTimestamp(); diff --git a/api/application/libraries/pdfgen_tcpdf.php b/api/application/libraries/pdfgen_tcpdf.php index cf01e150..babb8a8d 100644 --- a/api/application/libraries/pdfgen_tcpdf.php +++ b/api/application/libraries/pdfgen_tcpdf.php @@ -4,8 +4,8 @@ include_once APPPATH.'/vendor/autoload.php'; -include_once APPPATH.'/vendor/tecnickcom/tcpdf'; - +include_once APPPATH.'/vendor/tecnickcom/tcpdf/tcpdf.php'; +//use \tecnickcom\tcpdf\tcpdf; class pdfgen_tcpdf extends TCPDF { diff --git a/api/application/views/index.tpl b/api/application/views/index.tpl deleted file mode 100644 index 8539bdf0..00000000 --- a/api/application/views/index.tpl +++ /dev/null @@ -1,10 +0,0 @@ - - -Info - - -Test Article: -Title: {$title} -Description: {$description} - - \ No newline at end of file diff --git a/api/application/views/report_templates/index.tpl b/api/application/views/report_templates/index.tpl deleted file mode 100644 index 87814e2f..00000000 --- a/api/application/views/report_templates/index.tpl +++ /dev/null @@ -1,45 +0,0 @@ - - -PD Report - - -PD Report ID: {$pdid} -Main Applicant Name: {$main_applicant_name} -Customer Segment: {$cus_seg} -Lender: {$lender_name} -

Product :- {$product}

- - -

Business Info - Type Of Activity

-{if $type_of_activity eq "Manufacturing"} - Manufacturing Products -{elseif $type_of_activity eq "Retails"} - Retails - {elseif $type_of_activity eq "Service Providers"} - Service Providers -{else} - Others -{/if} - -

List of Co - Applicant's with Foreach

-{foreach $applicants as $applicant} -{if $applicant.name > 50} -

{$applicant.name}

-

{$applicant.age}

-{else} -

{$applicant.name}

-

{$applicant.age}

-{/if} -{/foreach} - -

List of Co - Applicant's With Section

-{section name=a loop=$applicants} - {$applicants[a].name} * - {$applicants[a].age}
- -{/section} - - - - - \ No newline at end of file