Skip to content

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 3. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

License

Unknown, LGPL-3.0 licenses found

Licenses found

Unknown
LICENSE
LGPL-3.0
LICENSE-LGPL-3.txt
Notifications You must be signed in to change notification settings

openhtmltopdf/openhtmltopdf

 
 

Repository files navigation

build-release

OPEN HTML TO PDF

PDF screenshot of OpenHTMLtoPDF

OVERVIEW

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.

GETTING STARTED

DIFFERENCES WITH FLYING SAUCER

  • 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.

LICENSE

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.

ACCREDITATION

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

FAQ

  • 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

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.

CHANGELOG

NEWER VERSIONS: SEE COMMIT LOG BETWEEN TAGS

1.1.8 (2024-April-26)

  • #29 Update README to clarify fork and differences to old project. Thanks, @XSpielinbox and @siegelzc.

1.1.7 (2024-April-26)

  • ebee9c0 Don't run release pipeline from forks. Thanks, @madsop-nav.
  • cdbd127 Automatically publish new versions to Maven Central. Thanks, @madsop-nav.

1.1.6 (2024-April-26)

  • 84b2cd0 correct release target java version to 8. Thanks, @madsop-nav.
  • edd9c53 Use the proper tag. Thanks, @madsop-nav.

1.1.5 (2024-April-25)

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.

1.1.4 (2023-October-1)

  • 9fbf939 SECURITY Update dependencies. Thanks, @imario42.

1.1.3 (2023-September-15)

  • b0a40b7 prepare for release. Thanks, @imario42.

1.1.2 (2023-September-15)

NOTE: This release is only available from GitHub.

  • 729d1ce prepare for release. Thanks, @imario42.

1.1.1 (2023-September-15)

NOTE: This release is only available from GitHub.

  • ea8a2b9 prepare for release. Thanks, @imario42.

1.1.0 (2023-September-15)

NOTE: This is the first release of the community fork. This release is only available from GitHub.

  • 16b6dd5 Update to PDFBOX 3. Thanks, @imario42.
  • 99eb141 changed maven group id to at.datenwort.openhtmltopdf. Thanks, @imario42.
  • 260aabf prepare for release. Thanks, @imario42.

OLDER RELEASES

View CHANGELOG.md.

About

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 3. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!

Resources

License

Unknown, LGPL-3.0 licenses found

Licenses found

Unknown
LICENSE
LGPL-3.0
LICENSE-LGPL-3.txt

Stars

Watchers

Forks

Languages

  • Java 60.3%
  • HTML 37.0%
  • CSS 2.2%
  • Other 0.5%