Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W3CDom::fromJsoup breaks inputs in HTML forms #445

Closed
testinfected opened this issue Feb 17, 2020 · 4 comments
Closed

W3CDom::fromJsoup breaks inputs in HTML forms #445

testinfected opened this issue Feb 17, 2020 · 4 comments

Comments

@testinfected
Copy link

testinfected commented Feb 17, 2020

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

@danfickle
Copy link
Owner

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>

@testinfected
Copy link
Author

testinfected commented Feb 27, 2020

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,

@danfickle
Copy link
Owner

Thanks @testinfected,

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

@testinfected
Copy link
Author

Thanks @danfickle, that's great news!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants