{"id":18453944,"url":"https://github.com/dotblue/nette-pdf","last_synced_at":"2025-04-08T03:35:35.734Z","repository":{"id":23847537,"uuid":"27225221","full_name":"dotblue/nette-pdf","owner":"dotblue","description":"🖨️ Generate PDFs in Nette Framework using mPDF","archived":false,"fork":false,"pushed_at":"2023-05-18T07:45:29.000Z","size":18,"stargazers_count":7,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-23T06:48:56.332Z","etag":null,"topics":["extension","mpdf","nette","nette-application","pdf","pdf-generation"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dotblue.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-27T12:52:08.000Z","updated_at":"2023-05-18T07:45:20.000Z","dependencies_parsed_at":"2022-08-22T06:10:48.900Z","dependency_job_id":null,"html_url":"https://github.com/dotblue/nette-pdf","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotblue%2Fnette-pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotblue%2Fnette-pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotblue%2Fnette-pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dotblue%2Fnette-pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dotblue","download_url":"https://codeload.github.com/dotblue/nette-pdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223302151,"owners_count":17123022,"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":["extension","mpdf","nette","nette-application","pdf","pdf-generation"],"created_at":"2024-11-06T08:02:14.939Z","updated_at":"2024-11-06T08:02:15.629Z","avatar_url":"https://github.com/dotblue.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"#### Requirements\n\n- PHP 7.3+\n- [mpdf/mpdf](https://github.com/finwe/mpdf) ~7.0\n- [nette/application](https://github.com/nette/application) \u003e= 3.0\n- [nette/di](https://github.com/nette/di) \u003e= 3.0\n- [nette/utils](https://github.com/nette/utils) \u003e= 3.0\n\n## Installation\n\n1) Copy source using [Composer](http://getcomposer.org/):\n```sh\n$ composer require dotblue/nette-pdf@~3.0\n```\n\n2) Register as Configurator's extension:\n```\nextensions:\n\tmpdf: DotBlue\\Mpdf\\DI\\Extension\n```\n\n## Configuration\n\nFirst you need to tell the addon where you store PDF documents' templates.\n\n```\nmpdf:\n\ttemplatesDir: %appDir%/templates/pdf\n```\n\nIn the app, you usually have several types of PDF documents that you wish to generate. Such type is called *theme*. Each theme should have its own directory located in `templatesDir`. You can configure theme via many directives which mPDF supports.\n\n```\nmpdf:\n\tthemes:\n\t\tinvoice:\n\t\t\tmargin:\n\t\t\t\tleft: 20\n\t\t\t\tright: 20\n\t\t\t\ttop: 20\n\t\t\t\tbottom: 20\n```\n\nDefault settings are following:\n\n```\nencoding: utf-8\nimg_dpi: 120\nformat: A4\nmargin:\n\tleft: 0\n\tright: 0\n\ttop: 0\n\tbottom: 0\n```\n\nEach theme has built-in support for external stylesheet. If you put `style.css` file into theme's directory, it will be automatically bundled into PDF document.\n\n### Fonts\n\nCustom fonts can be configured in following way:\n\n```\nfonts:\n\troboto:\n\t\tR: %appDir%/fonts/Roboto.ttf\n```\n\nSupported types are R (regular), B (bold), I (italic) and BI (bold \u0026 italic).\n\n## Usage\n\nThere is only one service: `DotBlue\\Mpdf\\DocumentFactory`. Granted that you have `default.latte` file in our `invoice` theme directory, you can create new PDF document like this:\n\n```php\n$invoiceDocument = $documentFactory-\u003ecreatePdf('invoice');\n```\n\nVariable `$invoiceDocument` is instance of `DotBlue\\Mpdf\\Document`, which provides simple API for printing or saving, and for linking images. If you would like to save the invoice somewhere on hard drive, you can call `saveTo()` method.\n\n```php\n$invoiceDocument-\u003esaveTo(__DIR__ . '/invoice.pdf');\n```\n\nOr you can show document to user in browser:\n\n```php\n$invoiceDocument-\u003eprintPdf();\n```\n\n### Variants\n\nTheme can support more variants. Actually method `createPdf()` has second optional argument, and its default value is `default.latte`. By changing this, your theme can support many variants either of type or for example of localization.\n\nAs third argument you can pass array of directives right for mPDF, which will override your theme default settings.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotblue%2Fnette-pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdotblue%2Fnette-pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdotblue%2Fnette-pdf/lists"}