{"id":13494170,"url":"https://github.com/xhtml2pdf/xhtml2pdf","last_synced_at":"2025-12-16T22:03:08.846Z","repository":{"id":37470932,"uuid":"1755413","full_name":"xhtml2pdf/xhtml2pdf","owner":"xhtml2pdf","description":"A library for converting HTML into PDFs using ReportLab","archived":false,"fork":false,"pushed_at":"2025-09-08T22:13:42.000Z","size":46673,"stargazers_count":2340,"open_issues_count":133,"forks_count":656,"subscribers_count":72,"default_branch":"master","last_synced_at":"2025-09-20T12:06:09.764Z","etag":null,"topics":["html-pdf","html-pdf-converter","html-to-pdf","html-to-pdf-converter","pdf","pdf-converter","pdf-generation","pypdf","python","reportlab","reportlab-pdf"],"latest_commit_sha":null,"homepage":"https://xhtml2pdf.readthedocs.io/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xhtml2pdf.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"patreon":"xhtml2pdf","custom":["https://blockstream.info/address/bc1qmr0skzwx5scyvh2ql28f7gfh6l65ua250qv227"]}},"created_at":"2011-05-16T13:45:29.000Z","updated_at":"2025-09-20T08:25:02.000Z","dependencies_parsed_at":"2023-10-05T03:58:26.829Z","dependency_job_id":"a10d4471-f0a0-47a5-a52b-e0722413d212","html_url":"https://github.com/xhtml2pdf/xhtml2pdf","commit_stats":{"total_commits":798,"total_committers":157,"mean_commits":5.082802547770701,"dds":0.8358395989974937,"last_synced_commit":"d99e3137c5e641cdeddaa3dd3d6a35bb60c88259"},"previous_names":["chrisglass/xhtml2pdf"],"tags_count":29,"template":false,"template_full_name":null,"purl":"pkg:github/xhtml2pdf/xhtml2pdf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhtml2pdf%2Fxhtml2pdf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhtml2pdf%2Fxhtml2pdf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhtml2pdf%2Fxhtml2pdf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhtml2pdf%2Fxhtml2pdf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xhtml2pdf","download_url":"https://codeload.github.com/xhtml2pdf/xhtml2pdf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xhtml2pdf%2Fxhtml2pdf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276590875,"owners_count":25669393,"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","status":"online","status_checked_at":"2025-09-23T02:00:09.130Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["html-pdf","html-pdf-converter","html-to-pdf","html-to-pdf-converter","pdf","pdf-converter","pdf-generation","pypdf","python","reportlab","reportlab-pdf"],"created_at":"2024-07-31T19:01:22.523Z","updated_at":"2025-09-23T14:38:22.870Z","avatar_url":"https://github.com/xhtml2pdf.png","language":"Python","readme":"XHTML2PDF\n=========\n\n.. image:: https://img.shields.io/pypi/v/xhtml2pdf?label=PyPI\u0026logo=PyPI\u0026logoColor=white\u0026color=blue\n    :target: https://pypi.python.org/pypi/xhtml2pdf\n    :alt: PyPI version\n\n.. image:: https://img.shields.io/pypi/pyversions/xhtml2pdf?label=Python\u0026logo=Python\u0026logoColor=white\n    :target: https://www.python.org/downloads\n    :alt: Python versions\n\n.. image:: https://img.shields.io/coveralls/github/xhtml2pdf/xhtml2pdf?label=Coveralls\u0026logo=Coveralls\u0026logoColor=white\n    :target: https://coveralls.io/github/xhtml2pdf/xhtml2pdf\n    :alt: Coveralls\n\n.. image:: https://img.shields.io/readthedocs/xhtml2pdf?label=Read%20the%20Docs\u0026logo=read%20the%20docs\u0026logoColor=white\n   :target: http://xhtml2pdf.readthedocs.io/en/latest/?badge=latest\n   :alt: Read the Docs\n\n|\n\nRelease Notes can be found here: `Release Notes \u003chttps://xhtml2pdf.readthedocs.io/en/latest/release-notes.html\u003e`__\nAs with all open-source software, its use in production depends on many factors, so be aware that you may find issues in some cases.\n\n**Big thanks** to everyone who has worked on this project so far and to those who help maintain it.\n\nAbout\n=====\n\nxhtml2pdf is a HTML to PDF converter using Python, the ReportLab Toolkit, html5lib and pypdf. It supports HTML5 and CSS 2.1 (and some of CSS 3). It is completely written in pure Python, so it is platform independent.\n\nThe main benefit of this tool is that a user with web skills like HTML and CSS is able to generate PDF templates very quickly without learning new technologies.\n\nPlease consider support this project using `Patreon \u003chttps://www.patreon.com/xhtml2pdf\u003e`__ or Bitcoins: ``bc1qmr0skzwx5scyvh2ql28f7gfh6l65ua250qv227``\n\n\n\nDocumentation\n==============\n\nThe documentation of xhtml2pdf is available at `Read the Docs \u003chttp://xhtml2pdf.readthedocs.io\u003e`__.\n\nAnd we could use your help improving it! A good place to start is ``doc/source/usage.rst``.\n\n\nInstallation\n============\n\nThis is a typical Python library and can be installed using pip::\n\n    pip install xhtml2pdf\n\n\nRequirements\n============\n\nOnly Python 3.8+ is tested and guaranteed to work.\n\nAll mandatory requirements are listed in the ``pyproject.toml`` file and are installed automatically using the ``pip install xhtml2pdf`` method.\n\nAs PDF library we depend on reportlab, which needs a rendering backend to generate bitmaps and vector graphic formats.\nFor more information about this, have a look at the `reportlab docs \u003chttps://docs.reportlab.com/install/open_source_installation/\u003e`__.\n\nThe recommended choice is the `cairo graphics library \u003chttps://cairographics.org/\u003e`__ which has to be installed system-wide e.g. via the OS package manager\nin combination with the ``PyCairo`` extra dependency:\n\n    pip install xhtml2pdf[pycairo]\n\nAlternatively, the legacy ``RenderPM`` can be used by installing:\n\n    pip install xhtml2pdf[renderpm]\n\n\nAlternatives\n============\n\nYou can try `WeasyPrint \u003chttp://weasyprint.org\u003e`__. The codebase is pretty, it has different features and it does a lot of what xhtml2pdf does.\n\n\nCall for testing\n================\n\nThis project is heavily dependent on getting its test coverage up! Furthermore, parts of the codebase could do well with cleanups and refactoring.\n\nIf you benefit from xhtml2pdf, perhaps look at the `test coverage \u003chttps://coveralls.io/github/xhtml2pdf/xhtml2pdf\u003e`__ and identify parts that are yet untouched.\n\n\nDevelopment environment\n=======================\n\n#. If you don't have it, install ``pip``, the python package installer::\n\n    sudo easy_install pip\n\n   For more information about ``pip`` refer to http://www.pip-installer.org\n\n#. We will recommend using ``venv`` for development.\n\n#. Create a virtual environment for the project. This can be inside the project directory, but cannot be under version control::\n\n    python -m venv .venv\n\n#. Activate your virtual environment::\n\n    source .venv/bin/activate\n\n   Later to deactivate it use::\n\n    deactivate\n\n#. The next step will be to install/upgrade dependencies from the ``pyproject.toml`` file::\n\n    pip install -e .[test,docs,build]\n\n#. Run tests to check your configuration::\n\n    tox\n\n   You should have a log with the following success status::\n\n    congratulations :) (75.67 seconds)\n\n\nPython integration\n==================\n\nSome simple demos of how to integrate xhtml2pdf into a Python program may be found here: ``test/simple.py``\n\n\nRunning tests\n=============\n\nTwo different test suites are available to assert that xhtml2pdf works reliably:\n\n#. Unit tests. The unit testing framework is currently minimal, but is being\n   improved on a regular basis (contributions welcome). They should run in the\n   expected way for Python's unittest module, i.e.::\n\n        tox\n\n#. Functional tests. Thanks to mawe42's super cool work, a full functional\n   test suite is available at ``testrender/``.\n\nYou can run them using make\n\n.. code:: bash\n\n        make test       # run tests\n        make test-ref   # generate reference data for testrender\n        make test-all   # Run all test using tox\n\nContact\n=======\n\nThis project is community-led! Feel free to open up issues on GitHub about new ideas to improve xhtml2pdf.\n\n\nHistory\n=======\n\nThese are the major milestones and the maintainers of the project:\n\n* 2000-2007 Dirk Holtwick (commercial project of spirito.de)\n* 2007-2010 Dirk Holtwick (project named \"pisa\", project released as GPL)\n* 2010-2012 Dirk Holtwick (project named \"xhtml2pdf\", changed license to Apache)\n* 2012-2015 Chris Glass (@chrisglass)\n* 2015-2016 Benjamin Bach (@benjaoming)\n* 2016-2018 Sam Spencer (@LegoStormtroopr)\n* 2018-Current Luis Zarate (@luisza)\n\nFor more history, see the `Release Notes \u003chttps://xhtml2pdf.readthedocs.io/en/latest/release-notes.html\u003e`__.\n\nLicense\n=======\n\nCopyright 2010 Dirk Holtwick, holtwick.it\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","funding_links":["https://patreon.com/xhtml2pdf","https://blockstream.info/address/bc1qmr0skzwx5scyvh2ql28f7gfh6l65ua250qv227","https://www.patreon.com/xhtml2pdf"],"categories":["Python","资源列表","PYTHON","前端开发框架及项目","Source Projects","HTML Processing","HTML Manipulation"],"sub_categories":["HTML 处理","其他_文本生成、文本对话"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxhtml2pdf%2Fxhtml2pdf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxhtml2pdf%2Fxhtml2pdf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxhtml2pdf%2Fxhtml2pdf/lists"}