-
Notifications
You must be signed in to change notification settings - Fork 4
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
HTML Input for PDF Generation #1455
Conversation
OX-10783
The PDF renderer requires XHTML as input, and we used to rely on the invoker to provide valid content. However, luckily, the world has moved on from XHTML. In order to relax the requirements and facilitate reuse of HTML templates, this commit introduces an additional processing step that removes problematic elements and ensures XHTML automatically. OX-10783
OX-10783
@@ -53,14 +55,37 @@ public boolean generate(Generator generator, OutputStream out) throws Exception | |||
ITextRenderer renderer = new ITextRenderer(); | |||
renderer.getSharedContext() | |||
.setReplacedElementFactory(new ImageReplacedElementFactory(renderer.getOutputDevice())); | |||
renderer.setDocumentFromString(content); | |||
renderer.setDocumentFromString(cleanHtml(content)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: Maybe this could be enabled optionally? Don't know if it could break stuff in S2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, how? As an additional pseudo-parameter in the context? As a system-wide setting? Both do not seem to be particularly elegant 😇
Let's see what S2 is going to say about this PR, okay? We can also flag it as breaking, but it should process all previously valid input as it was, and only affect the behaviour in case of faulty input.
OX-10783
Description
The Flying Saucer PDF renderer requires XHTML as input, and we rely on the invoker to provide valid content. However, luckily, the world has moved on from XHTML. In order to relax the requirements and facilitate reuse of HTML templates, this PR introduces an additional processing step that removes problematic elements and ensures XHTML automatically.
Marked as breaking as PDF rendering should be checked after upgrading.
Additional Notes
Checklist