[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8255":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":29,"readmeContent":30,"aiSummary":31,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":32,"discoverSource":33},8255,"laravel-dompdf","barryvdh\u002Flaravel-dompdf","barryvdh","A DOMPDF Wrapper for Laravel","",null,"PHP",7268,979,113,97,0,2,11,6,39.97,"MIT License",false,"master",true,[26,27,28],"hacktoberfest","laravel","pdf","2026-06-12 02:01:51","## DOMPDF Wrapper for Laravel\n\n### Laravel wrapper for [Dompdf HTML to PDF Converter](https:\u002F\u002Fgithub.com\u002Fdompdf\u002Fdompdf)\n\n[![Tests](https:\u002F\u002Fgithub.com\u002Fbarryvdh\u002Flaravel-dompdf\u002Fworkflows\u002FTests\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fbarryvdh\u002Flaravel-dompdf\u002Factions)\n[![Packagist License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicence-MIT-blue)](http:\u002F\u002Fchoosealicense.com\u002Flicenses\u002Fmit\u002F)\n[![Latest Stable Version](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fv\u002Fbarryvdh\u002Flaravel-dompdf?label=Stable)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fbarryvdh\u002Flaravel-dompdf)\n[![Total Downloads](https:\u002F\u002Fimg.shields.io\u002Fpackagist\u002Fdt\u002Fbarryvdh\u002Flaravel-dompdf.svg?label=Downloads)](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fbarryvdh\u002Flaravel-dompdf)\n[![Fruitcake](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPowered%20By-Fruitcake-b2bc35.svg)](https:\u002F\u002Ffruitcake.nl\u002F)\n\n## Installation\n\n### Laravel\nRequire this package in your composer.json and update composer. This will download the package and the dompdf + fontlib libraries also.\n\n    composer require barryvdh\u002Flaravel-dompdf\n\n### Lumen\n\nAfter updating composer add the following lines to register provider in `bootstrap\u002Fapp.php`\n\n  ```\n  $app->register(\\Barryvdh\\DomPDF\\ServiceProvider::class);\n  ```\n  \nTo change the configuration, copy the config file to your config folder and enable it in `bootstrap\u002Fapp.php`:\n\n  ```\n  $app->configure('dompdf');\n  ```\n  \n## Using\n\nYou can create a new DOMPDF instance and load a HTML string, file or view name. You can save it to a file, or stream (show in browser) or download.\n\n```php\n    use Barryvdh\\DomPDF\\Facade\\Pdf;\n\n    $pdf = Pdf::loadView('pdf.invoice', $data);\n    return $pdf->download('invoice.pdf');\n```\n\nor use the App container:\n\n```php\n    $pdf = App::make('dompdf.wrapper');\n    $pdf->loadHTML('\u003Ch1>Test\u003C\u002Fh1>');\n    return $pdf->stream();\n```\n\nOr use the facade:\n\nYou can chain the methods:\n\n```php\n    return Pdf::loadFile(public_path().'\u002Fmyfile.html')->save('\u002Fpath-to\u002Fmy_stored_file.pdf')->stream('download.pdf');\n```\n\nYou can change the orientation and paper size, and hide or show errors (by default, errors are shown when debug is on)\n\n```php\n    Pdf::loadHTML($html)->setPaper('a4', 'landscape')->setWarnings(false)->save('myfile.pdf')\n```\n\nIf you need the output as a string, you can get the rendered PDF with the output() function, so you can save\u002Foutput it yourself.\n\nUse `php artisan vendor:publish` to create a config file located at `config\u002Fdompdf.php` which will allow you to define local configurations to change some settings (default paper etc).\nYou can also use your ConfigProvider to set certain keys.\n\n### Configuration\nThe defaults configuration settings are set in `config\u002Fdompdf.php`. Copy this file to your own config directory to modify the values. You can publish the config using this command:\n```shell\n    php artisan vendor:publish --provider=\"Barryvdh\\DomPDF\\ServiceProvider\"\n```\n\nYou can still alter the dompdf options in your code before generating the pdf using this command:\n```php\n    Pdf::setOption(['dpi' => 150, 'defaultFont' => 'sans-serif']);\n```\n    \nAvailable options and their defaults:\n* __rootDir__: \"{app_directory}\u002Fvendor\u002Fdompdf\u002Fdompdf\"\n* __tempDir__: \"\u002Ftmp\" _(available in config\u002Fdompdf.php)_\n* __fontDir__: \"{app_directory}\u002Fstorage\u002Ffonts\" _(available in config\u002Fdompdf.php)_\n* __fontCache__: \"{app_directory}\u002Fstorage\u002Ffonts\" _(available in config\u002Fdompdf.php)_\n* __chroot__: \"{app_directory}\" _(available in config\u002Fdompdf.php)_\n* __logOutputFile__: \"\u002Ftmp\u002Flog.htm\"\n* __defaultMediaType__: \"screen\" _(available in config\u002Fdompdf.php)_\n* __defaultPaperSize__: \"a4\" _(available in config\u002Fdompdf.php)_\n* __defaultFont__: \"serif\" _(available in config\u002Fdompdf.php)_\n* __dpi__: 96 _(available in config\u002Fdompdf.php)_\n* __fontHeightRatio__: 1.1 _(available in config\u002Fdompdf.php)_\n* __isPhpEnabled__: false _(available in config\u002Fdompdf.php)_\n* __isRemoteEnabled__: false _(available in config\u002Fdompdf.php)_\n* __isJavascriptEnabled__: true _(available in config\u002Fdompdf.php)_\n* __isHtml5ParserEnabled__: true _(available in config\u002Fdompdf.php)_\n* __allowedRemoteHosts__: null _(available in config\u002Fdompdf.php)_\n* __isFontSubsettingEnabled__: false _(available in config\u002Fdompdf.php)_\n* __isPdfAEnabled__: false _(available in config\u002Fdompdf.php)_\n* __debugPng__: false\n* __debugKeepTemp__: false\n* __debugCss__: false\n* __debugLayout__: false\n* __debugLayoutLines__: true\n* __debugLayoutBlocks__: true\n* __debugLayoutInline__: true\n* __debugLayoutPaddingBox__: true\n* __pdfBackend__: \"CPDF\" _(available in config\u002Fdompdf.php)_\n* __pdflibLicense__: \"\"\n* __adminUsername__: \"user\"\n* __adminPassword__: \"password\"\n* __artifactPathValidation__: null _(available in config\u002Fdompdf.php)_\n\n#### Note: Since 3.x the remote access is disabled by default, to provide more security. Use with caution!\n\n### PDF\u002FA-3b Support\n\n> Requires dompdf >= 3.1.0 and the CPDF backend (default).\n\nYou can generate PDF\u002FA-3b compliant PDFs for archival purposes. Enable it globally via config or per-PDF at runtime.\n\n**Global (config\u002Fdompdf.php):**\n```php\n    'pdfa' => [\n        'enabled' => true,\n    ],\n```\n\n**Per-PDF at runtime:**\n```php\n    $pdf = Pdf::loadView('invoice', $data)\n        ->setPdfA()\n        ->download('invoice.pdf');\n```\n\n**Important:** PDF\u002FA requires all fonts to be embedded. Core PDF fonts (Helvetica, Courier, Times) are **not** embedded and will cause validation failures. Use fonts like `DejaVu Sans` or `DejaVu Serif` instead.\n\n#### Zugferd \u002F Factur-X (embedded XML invoices)\n\nFor PDF\u002FA-3b with embedded XML attachments (e.g. Zugferd\u002FFactur-X electronic invoicing), you can use `addEmbeddedFile()` and `setAdditionalXmpRdf()`:\n\n```php\n    $pdf = Pdf::loadView('invoice', $data)->setPdfA();\n\n    \u002F\u002F Add XMP metadata for Factur-X\n    $pdf->setAdditionalXmpRdf(\n        '\u003Crdf:Description rdf:about=\"\"\n            xmlns:fx=\"urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#\">\n            \u003Cfx:DocumentType>INVOICE\u003C\u002Ffx:DocumentType>\n            \u003Cfx:DocumentFileName>factur-x.xml\u003C\u002Ffx:DocumentFileName>\n            \u003Cfx:Version>1.0\u003C\u002Ffx:Version>\n            \u003Cfx:ConformanceLevel>BASIC\u003C\u002Ffx:ConformanceLevel>\n        \u003C\u002Frdf:Description>'\n    );\n\n    \u002F\u002F Embed the XML invoice\n    $pdf->addEmbeddedFile(\n        storage_path('invoices\u002Ffactur-x.xml'),\n        'factur-x.xml',\n        'Factur-X Invoice',\n        'text\u002Fxml'\n    );\n\n    return $pdf->download('invoice.pdf');\n```\n\n### Tip: UTF-8 support\nIn your templates, set the UTF-8 Metatag:\n\n    \u003Cmeta http-equiv=\"Content-Type\" content=\"text\u002Fhtml; charset=utf-8\"\u002F>\n\n### Tip: Page breaks\nYou can use the CSS `page-break-before`\u002F`page-break-after` properties to create a new page.\n\n    \u003Cstyle>\n    .page-break {\n        page-break-after: always;\n    }\n    \u003C\u002Fstyle>\n    \u003Ch1>Page 1\u003C\u002Fh1>\n    \u003Cdiv class=\"page-break\">\u003C\u002Fdiv>\n    \u003Ch1>Page 2\u003C\u002Fh1>\n    \n### License\n\nThis DOMPDF Wrapper for Laravel is open-sourced software licensed under the [MIT license](http:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n","barryvdh\u002Flaravel-dompdf 是一个用于 Laravel 的 DOMPDF 封装库，它允许开发者将 HTML 转换为 PDF 文档。该项目支持通过简单的 API 创建 PDF 文件，包括从视图、HTML 字符串或文件加载内容，并提供了保存、流式传输（在浏览器中显示）或下载生成的 PDF 文件的功能。此外，用户还可以自定义纸张大小、方向等选项以满足特定需求。此工具非常适合需要在 Laravel 应用程序中生成报告、发票或其他文档的场景。项目遵循 MIT 许可协议，保证了广泛的适用性和灵活性。","2026-06-11 03:17:01","top_language"]