{"id":18765310,"url":"https://github.com/setasign/fpdi","last_synced_at":"2025-05-13T00:29:27.855Z","repository":{"id":31700831,"uuid":"35266525","full_name":"Setasign/FPDI","owner":"Setasign","description":"FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF.","archived":false,"fork":false,"pushed_at":"2025-02-12T08:54:56.000Z","size":5674,"stargazers_count":1154,"open_issues_count":7,"forks_count":167,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-20T16:45:09.702Z","etag":null,"topics":["fpdf","fpdi","pdf","php"],"latest_commit_sha":null,"homepage":"https://www.setasign.com/fpdi","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"thinkgem/jeesite","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Setasign.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"tidelift":"packagist/setasign/fpdi"}},"created_at":"2015-05-08T08:02:29.000Z","updated_at":"2025-04-16T06:51:55.000Z","dependencies_parsed_at":"2024-04-23T15:59:40.979Z","dependency_job_id":"eb639248-4a77-47b7-93d8-fd5b267d6e7b","html_url":"https://github.com/Setasign/FPDI","commit_stats":{"total_commits":264,"total_committers":7,"mean_commits":"37.714285714285715","dds":"0.23106060606060608","last_synced_commit":"9e013b376939c0d4029f54150d2a16f3c67a5797"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FFPDI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FFPDI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FFPDI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Setasign%2FFPDI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Setasign","download_url":"https://codeload.github.com/Setasign/FPDI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250494804,"owners_count":21440043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["fpdf","fpdi","pdf","php"],"created_at":"2024-11-07T18:33:32.641Z","updated_at":"2025-04-23T18:44:49.064Z","avatar_url":"https://github.com/Setasign.png","language":"PHP","funding_links":["https://tidelift.com/funding/github/packagist/setasign/fpdi"],"categories":[],"sub_categories":[],"readme":"FPDI - Free PDF Document Importer\n=================================\n\n[![Latest Stable Version](https://poser.pugx.org/setasign/fpdi/v/stable.svg)](https://packagist.org/packages/setasign/fpdi)\n[![Total Downloads](https://poser.pugx.org/setasign/fpdi/downloads.svg)](https://packagist.org/packages/setasign/fpdi)\n[![License](https://poser.pugx.org/setasign/fpdi/license.svg)](https://packagist.org/packages/setasign/fpdi)\n\n:heavy_exclamation_mark: This document refers to FPDI 2. Version 1 is deprecated and development is discontinued. :heavy_exclamation_mark: \n\nFPDI is a collection of PHP classes facilitating developers to read pages from existing PDF\ndocuments and use them as templates in [FPDF](http://www.fpdf.org), which was developed by Olivier Plathey. Apart\nfrom a copy of [FPDF](http://www.fpdf.org), FPDI does not require any special PHP extensions.\n\nFPDI can also be used as an extension for [TCPDF](https://github.com/tecnickcom/TCPDF) or \n[tFPDF](http://fpdf.org/en/script/script92.php), too.\n\n## Installation with [Composer](https://packagist.org/packages/setasign/fpdi)\n\nBecause FPDI can be used with FPDF, TCPDF or tFPDF we haven't added a fixed dependency in the main\ncomposer.json file. You need to add the dependency to the PDF generation library of your choice\nyourself.\n\nTo use FPDI with FPDF include following in your composer.json file:\n\n```json\n{\n    \"require\": {\n        \"setasign/fpdf\": \"1.8.*\",\n        \"setasign/fpdi\": \"^2.5\"\n    }\n}\n```\n\nIf you want to use TCPDF, you have to update your composer.json to:\n\n```json\n{\n    \"require\": {\n        \"tecnickcom/tcpdf\": \"6.6.*\",\n        \"setasign/fpdi\": \"^2.5\"\n    }\n}\n```\n\nIf you want to use tFPDF, you have to update your composer.json to:\n\n```json\n{\n    \"require\": {\n        \"setasign/tfpdf\": \"1.33.*\",\n        \"setasign/fpdi\": \"^2.3\"\n    }\n}\n```\n\n## Manual Installation\n\nIf you do not use composer, just require the autoload.php in the /src folder:\n\n```php\nrequire_once('src/autoload.php');\n```\n\nIf you have a PSR-4 autoloader implemented, just register the src path as follows:\n```php\n$loader = new \\Example\\Psr4AutoloaderClass;\n$loader-\u003eregister();\n$loader-\u003eaddNamespace('setasign\\Fpdi', 'path/to/src/');\n```\n\n## Changes to Version 1\n\nVersion 2 is a complete rewrite from scratch of FPDI which comes with:\n- Namespaced code\n- Clean and up-to-date code base and style\n- PSR-4 compatible autoloading\n- Performance improvements by up to 100%\n- Less memory consumption\n- Native support for reading PDFs from strings or stream-resources\n- Support for documents with \"invalid\" data before their file-header\n- Optimized page tree resolving\n- Usage of individual exceptions\n- Several test types (unit, functional and visual tests)\n\nWe tried to keep the main methods and logical workflow the same as in version 1 but please\nnotice that there were incompatible changes which you should consider when updating to\nversion 2:\n- You need to load the code using the `src/autoload.php` file instead of `classes/FPDI.php`.\n- The classes and traits are namespaced now: `setasign\\Fpdi`\n- Page boundaries beginning with a slash, such as `/MediaBox`, are not supported anymore. Remove\n  the slash or use a constant of `PdfReader\\PageBoundaries`.\n- The parameters $x, $y, $width and $height of the `useTemplate()` or `getTemplateSize()`\n  method have more logical correct default values now. Passing `0` as width or height will\n  result in an `InvalidArgumentException` now.\n- The return value of `getTemplateSize()` had changed to an array with more speaking keys\n  and reusability: Use `width` instead of `w` and `height` instead of `h`.\n- If you want to use **FPDI with TCPDF** you need to refactor your code to use the class `Tcpdf\\Fpdi`\n(since 2.1; before it was `TcpdfFpdi`) instead of `FPDI`.\n\n## Example and Documentation\n\nA simple example, that imports a single page and places this onto a new created page:\n\n```php\n\u003c?php\nuse setasign\\Fpdi\\Fpdi;\n// or for usage with TCPDF:\n// use setasign\\Fpdi\\Tcpdf\\Fpdi;\n\n// or for usage with tFPDF:\n// use setasign\\Fpdi\\Tfpdf\\Fpdi;\n\n// setup the autoload function\nrequire_once('vendor/autoload.php');\n\n// initiate FPDI\n$pdf = new Fpdi();\n// add a page\n$pdf-\u003eAddPage();\n// set the source file\n$pdf-\u003esetSourceFile(\"Fantastic-Speaker.pdf\");\n// import page 1\n$tplId = $pdf-\u003eimportPage(1);\n// use the imported page and place it at point 10,10 with a width of 100 mm\n$pdf-\u003euseTemplate($tplId, 10, 10, 100);\n\n$pdf-\u003eOutput();            \n```\n\nA full end-user documentation and API reference is available [here](https://manuals.setasign.com/fpdi-manual/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetasign%2Ffpdi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsetasign%2Ffpdi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsetasign%2Ffpdi/lists"}