We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.PDF 10.3 - Set line height in HtmlFragment

I am trying to use the HtmlFragment class to set the font style for my PDF document. However, I am having trouble getting the line-height CSS property to work as expected. I’ve noticed that if I adjust the line-height, it will only adjust spacing right after a bolded line for some reason. What is the correct syntax for using the line height value in a way the CSS parser will understand? The reason I started playing with the line height is because I noticed blank lines in my PDF document were getting squashed to a much shorter height than non-blank lines.

var html = "<font style="font-family:courier; font-size:10pt; line-height:20px “>” + htmlBody + “”;

Hi Chris,

Thanks for contacting support.

Can you please share some complete HTML which can help us in replicating the issue in our environment. We are sorry for this inconvenience.

Sure, I have attached the test HTML here. Opening this HTML in IE shows the correct line spacing for blank lines, but when Aspose renders the PDF the blank lines almost completely disappear.

Below is the snippet I am using to add this attached html to the Aspose.PDF.Document object.

var page = document.Pages.Add();

var html = ConvertToHtml(pageText); // this would return the HTML attached here

var fragment = new HtmlFragment(html);


Hi Chris,

Thanks for sharing the resource files.

have tested the scenario and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as
will investigate this issue in details and will keep you updated on the status
of a correction. <o:p></o:p>

We apologize for your inconvenience.


Has the been any progress on this?

Hi Chris,

Thanks for your patience.

The issue reported earlier is still pending for review as the team has been busy fixing other priority issues reported earlier. However as soon as we have made some definite progress towards its resolution, we will let you know.

Your patience and comprehension is greatly appreciated in this regard.

The issues you have found earlier (filed as PDFNET-38532) have been fixed in Aspose.PDF for .NET 23.2.