Product: HTML2PDF Module (Java on Mac OS)
Product Version: 10.0.2
HTML2PDF converts css inside tag as plain text and the entire document loses all styling
The content on copy paste into an html file and viewing it in browser works well with styling rendered.
Im using insertFromHtmlString method in HTML2PDF
Note: The code works well with sample project provided by Apryse. but the same code doesnt work when integrated into my existing codebase.
Thank you for contacting us about this. You mentioned that this issue is only present in your application but the sample project works without any issues. Are there any differences in the code that you are using in your code base?
Do you have an example input HTML string and output PDF that showcases this issue? If you could provide screenshots of what you see on your end that would be most helpful.
There isnt any code differences. I get the html input as a string and using the same code from the code samples provided. The CSS is rendered as plain text. Will any errors in the html cause this issue ?
The HTML I work with might contain errors. When copied and rendered in a browser, the HTML is rendered fine, but from the code, the contents inside is rendered as plain text at the top and then the html content is displayed without any styling.
I will try to provide a smaller html with the issue replicating.
Note: Working with Play framework on Scala.
I was able to reproduce this with minimum HTML.
I Just kept a simple text “Hello!” with some styles in the tag
error_html.pdf (70.9 KB)
error.html (3.3 KB)
As you can see in the PDF, the CSS Styling is rendered as plain text
I figured it out, i left out the resources/ folder of the Mac HTML2PDF module. i turned on Debug logging to check. I could find logs of the module unable to find those files using setLogFilePath of HTML2PDF.
A suggestion: This could be shown as a warning or error with normal log level as the feature was working and I got a success with wrong PDF generation.