This is the community's next iteration of the OpenHTMLtoPDF project.
Open HTML to PDF is a pure-Java library for rendering a reasonable subset of well-formed XML/XHTML (and even some HTML5) using CSS 2.1 (and later standards) for layout and formatting, outputting to PDF or images.
Use this library to generated nice looking PDF documents. But be aware that you can not throw modern HTML5+ at this engine and expect a great result. You must special craft the HTML document for this library and use it's extended CSS feature like #31 or #32 to get good results. Avoid floats near page breaks and use table layouts.
- Maven Central registry
- 1.0.10 Online Sandbox
- Templates for Openhtmltopdf
- MIT licensed templates that work with this project. Updated 2021-09-21.
- Showcase Document - PDF
- Documentation wiki
- Note: This documentation is hosted on the old GitHub repository and has yet to be migrated
- Sample Project - Pretty Resume Generator
- Uses the well-maintained and open-source (LGPL compatible) PDFBOX as PDF library, rather than iText.
- Proper support for generating accessible PDFs (Section 508, PDF/UA, WCAG 2.0).
- Proper support for generating PDF/A standards compliant PDFs.
- New, faster renderer means this project can be several times faster for very large documents.
- Better support for CSS3 transforms.
- Automatic visual regression testing of PDFs, with many end-to-end tests.
- Ability to insert pages for cut-off content.
- Built-in plugins for SVG and MathML.
- Font fallback support.
- Limited support for RTL and bi-directional documents.
- On the negative side, no support for OpenType fonts.
- Footnote support.
- Much more. See changelog below.
Open HTML to PDF is distributed under the LGPL. Open HTML to PDF itself is licensed under the GNU Lesser General Public License, version 2.1 or later, available at https://www.gnu.org/copyleft/lesser.html. You can use Open HTML to PDF in any way and for any purpose you want as long as you respect the terms of the license. A copy of the LGPL license is included as license-lgpl-2.1.txt or license-lgpl-3.txt in our distributions and in our source tree.
An exception to this is the pdf-a testing module, which is licensed under the GPL. This module is not distributed to Maven Central and is for testing only.
Open HTML to PDF uses a couple of FOSS packages to get the job done. A list of these can be found in the dependency graph.
Thanks to @danfickle for his work advancing the OpenHtmlToPdf project beyond FlyingSaucer.
Open HTML to PDF is based on Flying-saucer. Credit goes to the contributors of that project. Code will also be used from neoFlyingSaucer
- OPEN HTML TO PDF is tested with Temurin 8, 11, 17 and 21. It requires at least Java 8 to run.
- No, you can not use it on Android.
- You should be able to use it on Google App Engine (Java 8 or greater environment). Let us know your experience.
Flowing columns are not implemented.Implemented in RC12.- No, it's not a web browser. Specifically, it does not run javascript or implement many modern standards such as flex and grid layout.
Test cases, failing or working are welcome, please place them
in /openhtmltopdf-examples/src/main/resources/testcases/
and run them
from /openhtmltopdf-examples/src/main/java/com/openhtmltopdf/testcases/TestcaseRunner.java
.
- #29 Update README to clarify fork and differences to old project. Thanks, @XSpielinbox and @siegelzc.
- ebee9c0 Don't run release pipeline from forks. Thanks, @madsop-nav.
- cdbd127 Automatically publish new versions to Maven Central. Thanks, @madsop-nav.
- 84b2cd0 correct release target java version to 8. Thanks, @madsop-nav.
- edd9c53 Use the proper tag. Thanks, @madsop-nav.
NOTE: This release is only available from GitHub.
- #3 Support classpath protocol. Thanks, @daniel-shuy and @siegelzc.
- #6 Fix compile error. Thanks, @madsop-nav and @siegelzc.
- #4 Set lower log level when loading an XML resource. Thanks, @icrnjak.
- #7 Updates to the GitHub Actions workflow. Thanks, @madsop-nav.
- #8 Improve ClassCondition performance. Thanks, @jochenberger and @siegelzc.
- #11 PDFBox version 3 documentation update. Thanks, @siegelzc and @imario42.
- #12 Minor dependency updates (pdfbox 3.0.1, graphics2d 3.0.1). Thanks, @ganomi and Stefan K.
- #9 Release mechanism - every push will trigger a release. Thanks, @madsop-nav.
- #14 Fine-tune GitHub Actions and versioning. Thanks, @madsop-nav.
- #17 FIX ignored at-rule after unrecognized at-rule. Thanks, @siegelzc and @zachary-foreflight.
- #18 Miscellaneous changes following #17. Thanks, @siegelzc and @zachary-foreflight.
- #22 Update pdfbox to 3.0.2. Thanks, @piotr-szachewicz.
- #20 Release mechanism and change group id to io.github.openhtmltopdf. Thanks, @madsop-nav.
- #33 Fix release process bugs. Thanks, @madsop-nav.
- #35 Minimize use of hardcoded versions. Thanks, @madsop-nav.
- 9fbf939 SECURITY Update dependencies. Thanks, @imario42.
- b0a40b7 prepare for release. Thanks, @imario42.
NOTE: This release is only available from GitHub.
- 729d1ce prepare for release. Thanks, @imario42.
NOTE: This release is only available from GitHub.
- ea8a2b9 prepare for release. Thanks, @imario42.
NOTE: This is the first release of the community fork. This release is only available from GitHub.