openhtmltopdf icon indicating copy to clipboard operation
openhtmltopdf copied to clipboard

Compliance with W3C Paged Media?

Open zopyx opened this issue 4 years ago • 3 comments

Hi there,

I am the maintainer of print-css.rocks.

Questions:

  • how compliant is openhtmltopdf with the CSS Paged Media standard of the W3C?
  • can you provide release files rather than the source code only?
  • can you provide a commandline utility for starting a conversion?

zopyx avatar Sep 23 '21 08:09 zopyx

Hi @zopyx,

I've seen your impressive website in the past and I have the repo starred.

We have some compliance with the paged media and generated content for page media standards including:

  • Footnotes (just released)
  • Page margin areas
  • Running elements
  • @page styles
  • Leaders
  • Target counters
  • Named pages
  • Orphans/widows
  • Explicit page breaks
  • Disallow page breaks inside
  • page and pages counters
  • Bookmarks are implemented but in a non-standard way

Additionally, we have some non-standard page features:

  • position: fixed content is repeated on each page in the main page content area
  • Ability to output extra pages for cut off content past the right page margin (or left in RTL mode)
  • -fs-page-break-min-height property, similar to orphans but for block boxes
  • Tables can be paginated (thead and tfoot repeat on each page) or not via custom CSS property
  • File embeds in the PDF

Some of what's missing:

  • Bleed and marks properties
  • Pages in the one document can not have different widths
  • Page groups are in the code but need work
  • Shrink to fit
  • Resetting, increment counters in the @page rule is currently broken
  • Much else

You can read about page features on the wiki or have a play on the project sandbox.

The release files are available via Maven Central. Generally one needs to use a JVM build tool to fetch the dependency tree so we do not release them on Github. However, while there is not currently a CLI, I can create one and upload to Github as a single "fat" jar which could be run something like the following:

java -jar openhtmltopdf.jar --input document.html --output document.pdf

You would still need Java (version 8 or above) on your machine. Let me know if this is something you'd like.

While I've got your attention, I was wondering if there is a license for the print-css-rocks repo? Some of the examples could make great tests.

Thanks for your interest, @danfickle.

danfickle avatar Sep 26 '21 05:09 danfickle

The feature list is impressive and I am intrigued to play with your tool for the next major release (in 2022).

Could you provide a link to the jar file? I really can not find it and I won't build it myself. Using JRE together with the JAR file would be totally fine.

The license of print-css.rocks is Creative Commons: https://www.print-css.rocks/about

zopyx avatar Sep 27 '21 16:09 zopyx

Hi @zopyx,

I've just uploaded the openhtmltopdf-cli.

Enjoy (hopefully)!

danfickle avatar Oct 02 '21 13:10 danfickle