I have below HTML string :
<font size="5">Requirements:</font><br><ul><li>Bullets are helpful</li><li>to display key points</li></ul><br>
How can I render above HTML into PDF at specific location?
I have checked some examples at http://itextpdf.com/sandbox/xmlworker but no where mentioned about this.
Your question isn't a duplicate, but it is related to these questions:
In both cases, we parse the HTML to an
ElementList
:We then create a
ColumnText
objectct
to which we add the elements:In the first question, the specific location is determined by the position of an AcroForm form field:
We create a
ColumnText
object like this:You'll have to do something similar if you want to render the HTML to an existing PDF.
The second example is somewhat awkward because we use the
ColumnText
to determine the height of the page. However, the principle is similar:In this case, I hard-coded the coordinates of the absolute position. It's a rectangle with lower-left corner x=120;y=600 and upper-right corner x=240;y=800.