{"id":13414467,"url":"https://github.com/dompdf/dompdf","last_synced_at":"2025-11-12T21:27:20.312Z","repository":{"id":5464960,"uuid":"6660366","full_name":"dompdf/dompdf","owner":"dompdf","description":"HTML to PDF converter for PHP","archived":false,"fork":false,"pushed_at":"2025-04-29T20:44:28.000Z","size":18863,"stargazers_count":10787,"open_issues_count":569,"forks_count":1810,"subscribers_count":291,"default_branch":"master","last_synced_at":"2025-05-05T15:51:25.435Z","etag":null,"topics":["css","dompdf","font","html","html-to-pdf","pdf-generation","php"],"latest_commit_sha":null,"homepage":"https://dompdf.github.io/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dompdf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.LGPL","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-11-12T20:47:16.000Z","updated_at":"2025-05-05T06:38:19.000Z","dependencies_parsed_at":"2023-12-12T13:44:24.666Z","dependency_job_id":"805f1b18-2d75-40da-bb80-87edbd4917c1","html_url":"https://github.com/dompdf/dompdf","commit_stats":{"total_commits":1681,"total_committers":162,"mean_commits":"10.376543209876543","dds":0.6728138013087448,"last_synced_commit":"626432aeb87ccc6e88fa814f06a2e9a6e57c0472"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dompdf%2Fdompdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dompdf%2Fdompdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dompdf%2Fdompdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dompdf%2Fdompdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dompdf","download_url":"https://codeload.github.com/dompdf/dompdf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253795648,"owners_count":21965575,"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":["css","dompdf","font","html","html-to-pdf","pdf-generation","php"],"created_at":"2024-07-30T21:00:22.077Z","updated_at":"2025-11-12T21:27:20.306Z","avatar_url":"https://github.com/dompdf.png","language":"PHP","readme":"Dompdf\n======\n\n[![Build Status](https://github.com/dompdf/dompdf/actions/workflows/test.yml/badge.svg)](https://github.com/dompdf/dompdf/actions/workflows/test.yml)\n[![PHP Versions Supported](https://poser.pugx.org/dompdf/dompdf/require/php)](https://packagist.org/packages/dompdf/dompdf)\n[![Latest Release](https://poser.pugx.org/dompdf/dompdf/v)](https://packagist.org/packages/dompdf/dompdf)\n[![Total Downloads](https://poser.pugx.org/dompdf/dompdf/downloads)](https://packagist.org/packages/dompdf/dompdf)\n[![License](https://poser.pugx.org/dompdf/dompdf/license)](https://packagist.org/packages/dompdf/dompdf)\n \n**Dompdf is an HTML to PDF converter**\n\nAt its heart, dompdf is (mostly) a [CSS 2.1](http://www.w3.org/TR/CSS2/) compliant\nHTML layout and rendering engine written in PHP. It is a style-driven renderer:\nit will download and read external stylesheets, inline style tags, and the style\nattributes of individual HTML elements. It also supports most presentational\nHTML attributes.\n\n*This document applies to the latest stable code which may not reflect the current \nrelease. For released code please\n[navigate to the appropriate tag](https://github.com/dompdf/dompdf/tags).*\n\n----\n\n**Check out the [demo](http://eclecticgeek.com/dompdf/debug.php) and ask any\nquestion on [StackOverflow](https://stackoverflow.com/questions/tagged/dompdf) or\nin [Discussions](https://github.com/dompdf/dompdf/discussions).**\n\nFollow us on [![Twitter](http://twitter-badges.s3.amazonaws.com/twitter-a.png)](http://www.twitter.com/dompdf).\n\n---\n\n\n\n## Features\n\n * Handles most CSS 2.1 and a few CSS3 properties, including @import, @media \u0026\n   @page rules\n * Supports most presentational HTML 4.0 attributes\n * Supports external stylesheets, either local or through http/ftp (via\n   fopen-wrappers)\n * Supports complex tables, including row \u0026 column spans, separate \u0026 collapsed\n   border models, individual cell styling\n * Image support (gif, png (8, 24 and 32 bit with alpha channel), bmp \u0026 jpeg)\n * No dependencies on external PDF libraries, thanks to the R\u0026OS PDF class\n * Inline PHP support\n * Basic SVG support (see \"Limitations\" below)\n \n## Requirements\n\n * PHP version 7.1 or higher\n * DOM extension\n * MBString extension\n * php-font-lib\n * php-svg-lib\n \nNote that some required dependencies may have further dependencies \n(notably php-svg-lib requires sabberworm/php-css-parser).\n\n### Recommendations\n\n * GD (for image processing)\n   * Additionally, the IMagick or GMagick extension improves image processing performance for certain image types\n * OPcache (OPcache, XCache, APC, etc.): improves performance\n\nVisit the wiki for more information:\nhttps://github.com/dompdf/dompdf/wiki/Requirements\n\n## About Fonts \u0026 Character Encoding\n\nPDF documents internally support the following fonts: Helvetica, Times-Roman,\nCourier, Zapf-Dingbats, \u0026 Symbol. These fonts only support Windows ANSI\nencoding. In order for a PDF to display characters that are not available in\nWindows ANSI, you must supply an external font. Dompdf will embed any referenced\nfont in the PDF so long as it has been pre-loaded or is accessible to dompdf and\nreference in CSS @font-face rules. See the\n[font overview](https://github.com/dompdf/dompdf/wiki/About-Fonts-and-Character-Encoding)\nfor more information on how to use fonts.\n\nThe [DejaVu TrueType fonts](https://dejavu-fonts.github.io/) have been pre-installed\nto give dompdf decent Unicode character coverage by default. To use the DejaVu\nfonts reference the font in your stylesheet, e.g. `body { font-family: DejaVu\nSans; }` (for DejaVu Sans). The following DejaVu 2.34 fonts are available:\nDejaVu Sans, DejaVu Serif, and DejaVu Sans Mono.\n\n## Easy Installation\n\n### Install with composer\n\nTo install with [Composer](https://getcomposer.org/), simply require the\nlatest version of this package.\n\n```bash\ncomposer require dompdf/dompdf\n```\n\nMake sure that the autoload file from Composer is loaded.\n\n```php\n// somewhere early in your project's loading, require the Composer autoloader\n// see: http://getcomposer.org/doc/00-intro.md\nrequire 'vendor/autoload.php';\n```\n\n### Download and install\n\nDownload a packaged archive of dompdf and extract it into the \ndirectory where dompdf will reside\n\n * You can download stable copies of dompdf from\n   https://github.com/dompdf/dompdf/releases\n * Or download a nightly (the latest, unreleased code) from\n   http://eclecticgeek.com/dompdf\n\nUse the packaged release autoloader to load dompdf, libraries,\nand helper functions in your PHP:\n\n```php\n// include autoloader\nrequire_once 'dompdf/autoload.inc.php';\n```\n\nNote: packaged releases are named according using semantic\nversioning (_dompdf_MAJOR-MINOR-PATCH.zip_). So the 1.0.0 \nrelease would be dompdf_1-0-0.zip. This is the only download\nthat includes the autoloader for Dompdf and all its dependencies.\n\n### Install with git\n\nFrom the command line, switch to the directory where dompdf will\nreside and run the following commands:\n\n```sh\ngit clone https://github.com/dompdf/dompdf.git\ncd dompdf/lib\n\ngit clone https://github.com/PhenX/php-font-lib.git php-font-lib\ncd php-font-lib\ngit checkout 0.5.1\ncd ..\n\ngit clone https://github.com/PhenX/php-svg-lib.git php-svg-lib\ncd php-svg-lib\ngit checkout v0.3.2\ncd ..\n\ngit clone https://github.com/sabberworm/PHP-CSS-Parser.git php-css-parser\ncd php-css-parser\ngit checkout 8.1.0\n```\n\nRequire dompdf and it's dependencies in your PHP.\nFor details see the [autoloader in the utils project](https://github.com/dompdf/utils/blob/master/autoload.inc.php).\n\n## Framework Integration\n\n* For Symfony: [nucleos/dompdf-bundle](https://github.com/nucleos/NucleosDompdfBundle)\n* For Laravel: [barryvdh/laravel-dompdf](https://github.com/barryvdh/laravel-dompdf)\n* For Redaxo: [PdfOut](https://github.com/FriendsOfREDAXO/pdfout)\n\n## Quick Start\n\nJust pass your HTML in to dompdf and stream the output:\n\n```php\n// reference the Dompdf namespace\nuse Dompdf\\Dompdf;\n\n// instantiate and use the dompdf class\n$dompdf = new Dompdf();\n$dompdf-\u003eloadHtml('hello world');\n\n// (Optional) Setup the paper size and orientation\n$dompdf-\u003esetPaper('A4', 'landscape');\n\n// Render the HTML as PDF\n$dompdf-\u003erender();\n\n// Output the generated PDF to Browser\n$dompdf-\u003estream();\n```\n\n### Setting Options\n\nSet options during dompdf instantiation:\n\n```php\nuse Dompdf\\Dompdf;\nuse Dompdf\\Options;\n\n$options = new Options();\n$options-\u003eset('defaultFont', 'Courier');\n$dompdf = new Dompdf($options);\n```\n\nor at run time\n\n```php\nuse Dompdf\\Dompdf;\n\n$dompdf = new Dompdf();\n$options = $dompdf-\u003egetOptions();\n$options-\u003esetDefaultFont('Courier');\n$dompdf-\u003esetOptions($options);\n```\n\nSee [Dompdf\\Options](src/Options.php) for a list of available options.\n\n### Resource Reference Requirements\n\nIn order to protect potentially sensitive information Dompdf imposes \nrestrictions on files referenced from the local file system or the web. \n\nFiles accessed through web-based protocols have the following requirements:\n * The Dompdf option \"isRemoteEnabled\" must be set to \"true\"\n * PHP must either have the curl extension enabled or the \n   allow_url_fopen setting set to true\n   \nFiles accessed through the local file system have the following requirement:\n * The file must fall within the path(s) specified for the Dompdf \"chroot\" option\n\n## Limitations (Known Issues)\n\n * Table cells are not pageable, meaning a table row must fit on a single page: See https://github.com/dompdf/dompdf/issues/98\n * Elements are rendered on the active page when they are parsed.\n * Embedding \"raw\" SVG's (`\u003csvg\u003e\u003cpath...\u003e\u003c/svg\u003e`) isn't working yet: See https://github.com/dompdf/dompdf/issues/320  \n   Workaround: Either link to an external SVG file, or use a DataURI like this:\n     ```php\n     $html = '\u003cimg src=\"data:image/svg+xml;base64,' . base64_encode($svg) . '\"\u003e';\n     ```\n * Does not support CSS flexbox: See https://github.com/dompdf/dompdf/issues/971\n * Does not support CSS Grid: See https://github.com/dompdf/dompdf/issues/2988\n * A single Dompdf instance should not be used to render more than one HTML document\n   because persisted parsing and rendering artifacts can impact future renders.\n---\n\n[![Donate button](https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif)](http://goo.gl/DSvWf)\n\n*If you find this project useful, please consider making a donation.\nAny funds donated will be used to help further development on this project.)*\n","funding_links":["https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif"],"categories":["PHP","Table of Contents","目录","PDF PDF","后端开发框架及项目","Programming Languages","类库"],"sub_categories":["PDF","PHP开发","PHP","PDF/条形码"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdompdf%2Fdompdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdompdf%2Fdompdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdompdf%2Fdompdf/lists"}