danfickle / openhtmltopdf

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

Home Page:https://danfickle.github.io/pdf-templates/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

W3CDom::fromJsoup breaks inputs in HTML forms

testinfected opened this issue · comments

Hi there,

Previously we were using the now removed DOMContent (in openhtmltopdf-jsoup-dom-converter) to convert HTML 5 using jsoup to a w3c DOM representation.

We've upgraded to 1.0.1 and use the latest jsoup as recommended in the integration guide, i.e.

...
var doc = Jsoup.parse(html);
var dom = new W3CDom().fromJsoup(doc);
...

Unfortunately it breaks our form inputs, which no longer appear in the generated pdf. It works with HTML tags with a corresponding closing tag (e.g. textarea), but apparently not with other tags.

Works fine with 1.0.1 and the old openhtmltopdf-jsoup-dom-converter

Hi @testinfected,

I suspect this could be an issue with namespaces. Are you able to try with a document that specifies no namespace? Something like:

<html>
<body>
<form>
  <input type="text" name="firstName">
</form>
</body>
</html>

Hi @danfickle

We don't have any namespace in our document. It's a plain HTML 5 document.

<!DOCTYPE html>
<html lang="en">
...

We have the same issue with the example at https://github.com/danfickle/openhtmltopdf/wiki/Form-Controls

Cheers,

Thanks @testinfected,

I've worked around the behavior of Jsoup converter now. It took a lot of debugging to find the root cause.

Thanks @danfickle, that's great news!