1. How do I draw a border around html. The
GetTextHeight function doesn’t seem to work as expected. This is what I
tried and didn’t work:
Dim pdf AsNew Aspose.Pdf.Generator.Pdf
Dim sec AsNew Aspose.Pdf.Generator.Section
pdf.Sections.Add(sec)
Dim txtHtml1 AsNew Aspose.Pdf.Generator.Text("This is my rich text.<br/><br/>This is
line 2 of rich text.<br/><i><b>Bold Italic and
Underline</b></i><br/><br/><b>Bold
line</b><br/><i>Italic
line</i><br/><b><i>Bold and Italic</i></b><br/><u>Underline</u><br/><br/><font
size='14'>Larger font</font><br/><br/><font
color='#0000ff' >Blue text</font><br/><font face='courier
new'>Times new Roman</font><br/>Normal
text<br/><br/> <br/><br/>")
txtHtml1.IsHtmlTagSupported = True
Dim boxHtml1 AsNew Aspose.Pdf.Generator.FloatingBox
boxHtml1.Border = New Aspose.Pdf.Generator.BorderInfo(CInt(Aspose.Pdf.Generator.BorderSide.All), 0.1F)
boxHtml1.BoxWidth = 300
boxHtml1.BoxHeight = txtHtml1.GetTextHeight(pdf, boxHtml1.BoxWidth)
boxHtml1.Paragraphs.Add(txtHtml1)
sec.Paragraphs.Add(boxHtml1)
pdf.Save("c:\temp\Aspose.pdf")
The height seems to be incorrect because its not taking into account the html has changed the size of the text. Is there a way to draw the boarder around all the text? Is there a way to measure the height of html text correctly?
If I have a chunk of text using html tags(so font size and etc... can change) and I know that the text won't fit into the a specified space and I will have to split it up into 2 specified places (2 boxes each 3 x 3 inches or something...) how would I write text into the first space and know where to stop and continue the rest of the text in the second box?