justshiv / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

OPEN HTML TO PDF

CURRENTY SEEKING FEEDBACK

OVERVIEW

Open HTML to PDF is a pure-Java library for rendering arbitrary well-formed XML/XHTML (and even HTML5) using CSS 2.1 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

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 http://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.

Open HTML to PDF uses a couple of FOSS packages to get the job done. A list of these, along with the license they each have, is listed in the LICENSE file in our distribution.

CREDITS

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 OpenJDK 7 and 11, Oracle JDK 8, 9, 11.
  • 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.

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

head - 0.0.1-RC18-SNAPSHOT

0.0.1-RC17

  • #284 #288 IMPORTANT: This release was brought forward due to a CVE in Apache Batik used by the optional SVG module. While this project strongly advises not to use untrusted XML either in SVG or XHTML, you may be using Batik in another part of your project and therefore it is a good idea to update. Thanks a lot @ghenadiibatalski, @chubbard
  • #286 #281 Fix for text decorations/background incorrect coverage in justified text. Thanks @koritakoa, @allartammik
  • #280 This will be the last release compatible with Java 7, from now on Java 8 or above will be required. Thanks for everyone's thoughts on this.

0.0.1-RC16

  • #279 #264 IMPORTANT: This release was brought forward so that we link against PDFBOX-2.0.12 as previous versions had another DOS security vulnerability when parsing arbitary PDF files. Also there was a security issue in the old version of JSoup used by the optional jsoup-dom-converter module. While I believe these vulnerabilities should not impact this project directly, having an insecure library on your classpath may be dangerous if you use it for other tasks. Thanks @rototor, @dheid
  • #279 Support for testing and running on JDK-11. Extensive work by @rototor. Thanks.
  • #278 Support for additional PDF/A conformance levels. Thanks @TheUnnamedDude
  • 87dc1a9 Fixed nasty bug where positioned elements (absolute, fixed) were being printed twice. By @danfickle
  • #271 Support right-to-left list items. Thanks @ieugen for work, @sandre1 for reporting.
  • Much more work on the fast renderer. But not ready for prime time yet!

0.0.1-RC15

  • NOTE: Started moving project documentation to wiki.
  • #228 Support for letter-spacing CSS property. By @danfickle
  • #143 Merging of remaining items thanks to @backslash47
    • Support for box-sizing:border-box. With additional work (for min/max width/height) by @danfickle
    • Text justification for embedded unicode fonts
    • #250 Optional PDF/A conformance. Thanks @syjer
  • #252 Incorrect placement of form controls. Thanks @tiredelk
  • #249 Cache font metrics across runs to avoid having to load fallback fonts on each run. By @danfickle
  • #254 Allow use of SVG image in image tag. Thanks @syjer

0.0.1-RC14

  • IMPORTANT: This release was brought forward so that we link against PDFBOX-2.0.11 as previous versions had a security vulnerability when parsing arbitary PDF files. While I believe this should not impact this project directly, having an insecure library on your classpath may be dangerous if you use it for other tasks. #241 #239 Thanks @rototor, @cseblog
  • NOTE: This release incorportate a new faster renderer (especially for large documents) that is in alpha state. Specifically, it can be used with everything except inline-blocks. You can start testing it now with builder.useFastMode() #180 Thanks @rajaningle @javimartinez @dilworks @rototor
  • Image with CSS max-width and max-height incorrectly scaled #242 Thanks @koan00
  • Bold and italic emulation #240 Thanks @syjer @backslash47
  • Work on correctly outputting multiple HTML files to one PDF #222 Thanks @rototor
  • ONGOING: Attempt at fixing font file handle leak #215 Thanks @rototor
  • Don't throw NPE when no base URI is provided #206
  • Fix link annotation placement in margin or generated boxes Thanks @jesselong, @Kuhlware, @markhowardnz

0.0.1-RC13

Note: Shaped links only work in Acrobat Reader. All other PDF reader seem to ignore them.

0.0.1-RC12

0.0.1-RC11

0.0.1-RC10

0.0.1-RC9

0.0.1-RC8

0.0.1-RC7

0.0.1-RC5

0.0.1-RC4

0.0.1-RC3

0.0.1-RC2

About

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support.

License:Other


Languages

Language:Java 64.0%Language:HTML 33.0%Language:CSS 2.3%Language:FreeMarker 0.5%Language:Lex 0.1%Language:AMPL 0.1%Language:Batchfile 0.0%