{"id":37235732,"url":"https://github.com/anklimsk/cakephp-tcpdf","last_synced_at":"2026-01-16T04:51:22.601Z","repository":{"id":56948515,"uuid":"143713055","full_name":"anklimsk/cakephp-tcpdf","owner":"anklimsk","description":"Generate PDF files with the CakePHP ","archived":false,"fork":false,"pushed_at":"2020-04-02T17:48:39.000Z","size":5327,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-07T01:01:49.414Z","etag":null,"topics":["cakephp-plugin","cakephp2","tcpdf"],"latest_commit_sha":null,"homepage":"https://anklimsk.github.io/cakephp-tcpdf","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anklimsk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-06T10:28:58.000Z","updated_at":"2020-04-02T17:44:49.000Z","dependencies_parsed_at":"2022-08-21T08:20:18.718Z","dependency_job_id":null,"html_url":"https://github.com/anklimsk/cakephp-tcpdf","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/anklimsk/cakephp-tcpdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-tcpdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-tcpdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-tcpdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-tcpdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anklimsk","download_url":"https://codeload.github.com/anklimsk/cakephp-tcpdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anklimsk%2Fcakephp-tcpdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cakephp-plugin","cakephp2","tcpdf"],"created_at":"2026-01-15T04:04:11.541Z","updated_at":"2026-01-15T04:04:12.184Z","avatar_url":"https://github.com/anklimsk.png","language":"PHP","readme":"# CakePHP 2.x Generate PDF files plugin\n[![Build Status](https://travis-ci.com/anklimsk/cakephp-tcpdf.svg?branch=master)](https://travis-ci.com/anklimsk/cakephp-tcpdf)\n[![Coverage Status](https://codecov.io/gh/anklimsk/cakephp-tcpdf/branch/master/graph/badge.svg)](https://codecov.io/gh/anklimsk/cakephp-tcpdf)\n[![Latest Stable Version](https://poser.pugx.org/anklimsk/cakephp2-tcpdf/v/stable)](https://packagist.org/packages/anklimsk/cakephp2-tcpdf)\n[![License](https://poser.pugx.org/anklimsk/cakephp2-tcpdf/license)](https://packagist.org/packages/anklimsk/cakephp2-tcpdf)\n\nGenerate PDF files with the CakePHP\n\n## This plugin provides next features:\n\n- Generate PDF files\n\n## Installation\n\n1. Install the Plugin using composer: `composer require anklimsk/cakephp2-tcpdf`\n2. Add the next line to the end of the file `app/Config/bootstrap.php`:\n\n   ```php\n   CakePlugin::load('CakeTCPDF', ['bootstrap' =\u003e true, 'routes' =\u003e true]);\n   ```\n\n## Using this plugin\n\n1. In your `Model`:\n   - Create the following methods:\n\n      ```php\n      public function getExportConfig() {\n          $header = [__('Field label 1'), __('Field label 2'), __('Field label 3'), __('Field label 4')];\n          $width = [35, 20, 10, 15];\n          $align = ['L', 'L', 'C', 'R'];\n          $fileName = __('Export file');\n\n          return compact('header', 'width', 'align', 'fileName');\n      }\n\n      public function getExportData($conditions = []) {\n          ...\n          $result = [\n              'Group header (List name)' =\u003e [\n                  'Sub header' =\u003e [\n                      [\n                          'Field value 1',\n                          'Field value 2',\n                          'Field value 3',\n                          'Field value 4',\n                      ]\n                  ]\n              ]\n          ];\n\n          return $result;\n      }\n       ```\n\n2. In your `Controller`:\n   - Add the `RequestHandler` component to `AppController`, and map `pdf` to \n     the CakeTCPDF plugin, e.g.:\n\n      ```php\n      public $components = [\n          ...,\n          'RequestHandler' =\u003e [\n              'viewClassMap' =\u003e [\n                  'pdf' =\u003e 'CakeTCPDF.Pdf'\n              ]\n          ]\n      );\n      ```\n\n   - Add to your controller action:\n\n      ```php\n      public export($id = null) {\n          if (!$this-\u003eRequestHandler-\u003eprefers('pdf')) {\n              throw new BadRequestException(__('Invalid export type');\n          }\n\n          $conditions = [];\n          if (!empty($id)) {\n              $conditions['Model.id'] = $id;\n          }\n          $exportConfig = $this-\u003eModel-\u003egetExportConfig();\n          $exportData = $this-\u003eModel-\u003egetExportData();\n\n          $this-\u003eset(compact('exportConfig', 'exportData'));\n      }\n      ```\n\n3. In your `View`:\n   - Create a link to the a action with the extension `.pdf`, e.g.:\n\n      ```php\n      $this-\u003eHtml-\u003elink('PDF file', ['ext' =\u003e 'pdf']);\n      ```\n\n   - Place the View templates in the subdirectory `Pdf`, e.g.:\n     `app/View/Invoices/Pdf/index.ctp`\n   - Use the `CakeTCPDF.exportPdfTable` element in your View file, e.g.:\n\n      ```php\n      if (!empty($exportConfig)) {\n          extract($exportConfig);\n      }\n\n      if (!isset($orientation)) {\n          $orientation = PDF_PAGE_ORIENTATION;\n      }\n\n      if (isset($fileName)) {\n          $this-\u003esetFileName($fileName);\n      }\n\n      $this-\u003etcpdf-\u003esetPageOrientation($orientation, TRUE, PDF_MARGIN_BOTTOM);\n      $this-\u003etcpdf-\u003eoptions['footerText'] = $this-\u003etcpdf-\u003egetAliasNumPage();\n\n      // set font\n      $this-\u003etcpdf-\u003eSetFont(PDF_FONT_NAME_DATA, 'B', PDF_FONT_SIZE_DATA);\n      // set default font subsetting mode\n      $this-\u003etcpdf-\u003esetFontSubsetting(true);\n\n      //set margins\n      $this-\u003etcpdf-\u003eSetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);\n      $this-\u003etcpdf-\u003eSetHeaderMargin(PDF_MARGIN_HEADER);\n      $this-\u003etcpdf-\u003eSetFooterMargin(PDF_MARGIN_FOOTER);\n\n      $this-\u003etcpdf-\u003eAddPage();\n      $this-\u003etcpdf-\u003esetPrintFooter(true);\n      echo $this-\u003eelement('CakeTCPDF.exportPdfTable', compact('exportConfig', 'exportData'));\n      ```\n\n   - Use the `CakeTCPDF.exportPdfTableContent` element in your View file, e.g.:\n\n      ```php\n      echo $this-\u003eelement('CakeTCPDF.exportPdfTableContent', compact('exportConfig'));\n      ```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanklimsk%2Fcakephp-tcpdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanklimsk%2Fcakephp-tcpdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanklimsk%2Fcakephp-tcpdf/lists"}