0

I use iText 5.5.4 in my web application. I have the following Java code to add tables and some HTML text to PDF:

HTMLWorker worker = new HTMLWorker(document)
...
worker.parse(new StringReader(html_snippets)); 

I am able to specify font size for Paragraph, etc., but I cannot seem to find a way to set font size for included HTML in the above situation.

Is there a solution to the above situation? Or change the above code?

Update

I found example here: I found examples here: https://developers.itextpdf.com/examples/xml-worker-itext5/html-tables

I should use XMLWorker instead of HTMLWorker.

halfer
  • 19,824
  • 17
  • 99
  • 186
curious1
  • 14,155
  • 37
  • 130
  • 231
  • As you can read in the duplicate question, `HTMLWorker` should no longer be used. The normal way of setting font sizes in HTML (that is: using CSS) isn't supported in `HTMLWorker` (and it never will). Font sizes were set using the `StyleSheet` class (see the example in the duplicate question), but I hope you don't use that as a solution. The real solution is to upgrade to iText 7 and pdfHTML. – Bruno Lowagie Dec 21 '17 at 21:17
  • Bruno, you are right. I found examples here: https://developers.itextpdf.com/examples/xml-worker-itext5/html-tables – curious1 Dec 21 '17 at 21:26

0 Answers0