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

Free Support Forum - aspose.com

Column Width problem converting HTML table to Pdf

Hi there!

I have the latest release of Aspose.Pdf for .NET (5.3.0.0)

When I export my HTML table to pdf the format of the column width doesn’t produce expected results.

For example:
--------------------------------------
Plant | D | Min | Max | Avg|
| ay| | | |
--------------------------------------
Saturn |1 | 1.67 | 15.72| 5.06|
-------------------------------------------
etc…
My Table looks like the above, when the day column has plenty of space to fit in one line. I tried css nowrap and min-width. Any suggestions.

I have included the code used to generate the html and the html in the attachment.

Thank you

Hello Andrew,

Thanks for your interest in our products.

I have tested the scenario using Aspose.Pdf for .NET 6.0.0 while using the following code snippet and as per my observations the PDF document is properly being generated. Please take a look over attached PDF document that I have generated. In case you still encounter any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

[C#]

// Instantiate an object PDF class
Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
// add the section to PDF document sections collection
Aspose.Pdf.Generator.Section section = pdf.Sections.Add();
// Read the contents of HTML file into StreamReader object
StreamReader r = File.OpenText(@"D:\pdftest\SampleTableAndCode\testHtml.html");
//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
// enable the property to display HTML contents within their own formatting
text2.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML text to the section
section.Paragraphs.Add(text2);
// Specify the URL which serves as images database
pdf.IsLandscape = true;
//Save the pdf document
pdf.Save(@"D:\pdftest\SampleTableAndCode\testHtml.pdf");