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

Free Support Forum - aspose.com

Aspose.Pdf for .Net 6.5 and 6.6 problems with converting HTML Tables

Hi,

I am having problems with Aspose.Pdf version 6.5 & 6.6 for .NET (using c#):

The following problems are to do with Aspose converting HTML

1) 6.5 cannot handle "tables without widths" correctly (i.e. if the first row has more text than the second row it goes with the width of the second row, which can get messy ...see example code),

2) 6.6 catagorically cannot handle a table within table.

3) 6.6 cannot tell wether the table is going off the page or not.

I have included the following code:

string HtmlString = "";

//1) The html is handled wrongly in version 6.5 but is fine in version 6.6

HtmlString = "

this cell should be bigger than below cell
cell this cell should be bigger than above
";

Text descriptionText = new Text(HtmlString);

descriptionText.IsHtmlTagSupported = true;

descriptionText.TextInfo.FontName = "verdana";

descriptionText.TextInfo.FontSize = 10;

pdfSection.Paragraphs.Add(descriptionText);

//2) The html is handled correctly in version 6.5 but is incorrect in version 6.6

HtmlString = @"

Score
Green
";

descriptionText = new Text(HtmlString);

descriptionText.IsHtmlTagSupported = true;

descriptionText.TextInfo.FontName = "verdana";

descriptionText.TextInfo.FontSize = 10;

pdfSection.Paragraphs.Add(descriptionText);

//3a) The html is handled correctly in version 6.5 but is incorrect in version 6.6

HtmlString = @"

 

Comment and impact

xxxxxxxxx

At 1033 employees aged xx- xx, The xxxxxxxxxxxxxx is a large xxxxxxx xxxxxxxx.

";

//3b) this is the same as above but without cell widths to show it does not know that it is going off the page.

HtmlString += @"

 

Comment and impact

xxxxxxxxx

At 1033 employees aged xx- xx, The xxxxxxxxxxxxxx is a large xxxxxxx xxxxxxxx. xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

";

descriptionText = new Text(HtmlString);

descriptionText.IsHtmlTagSupported = true;

descriptionText.TextInfo.FontName = "verdana";

descriptionText.TextInfo.FontSize = 10;

pdfSection.Paragraphs.Add(descriptionText);

I cant update my version 6.5 to version 6.6 to benifit from all the other bug fixes that have been done untill these areas are addressed,

For reference I cannot change the HTML to faccilitate aspose.pdf (i.e. the html is user/auto generated and out of my control).

Regards,

Matt

Hi Matt,

Thanks for using our products.

I have tested the scenario and I am able to notice the same problem. For the sake of correction, I have logged this problem as PDFNEWNET-33169 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction vis this forum thread.

We apologize for your inconvenience.

Thanks & Regards,

Hi Matt,

Thanks for your patience.

I am pleased to share that your reported issue has been fixed in our latest release version of Aspose.Pdf for .NET v6.8. Please try using it and in case you still face any problem or you have any further query, please feel free to contact. We are sorry for your inconvenience.

Thanks & Regards,

I am having a similar problem with eval version 6.8 I downloaded from your site. The table with the content extends beyond the edge of the resulting PDF. It prints correctly (entire table is view-able on printed page with columns narrowed to accommodate page width) in IE. Here is the code:


string htmlContent = “”;
htmlContent += “”;
htmlContent += “”;
htmlContent += “
”;
htmlContent += “”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
Type Date Code Description Reaction Source Comments
The problem ”;
htmlContent += “”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
First Noted: Sep 06, 2006
”;
htmlContent += “
Here is some content that replaces the original content in the table. Here is the description of the issue that is yet to be resolved. Can you help? Joe W. Smith Here are my comments regarding this issue.
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “
”;
htmlContent += “”;
htmlContent += “”;

var htmlPDF = new Pdf();
htmlPDF.HtmlInfo.ExternalResourcesBasePath = Path.GetDirectoryName(Assembly.GetCallingAssembly().Location);
var section = htmlPDF.Sections.Add();
section.PageInfo.Margin = new MarginInfo
{
Bottom = 72,
Top = 72,
Left = 20,
Right = 20
};
section.PageInfo.PageHeight = Aspose.Pdf.Generator.PageSize.LetterHeight;
section.PageInfo.PageWidth = Aspose.Pdf.Generator.PageSize.LetterWidth;
section.IsLandscape = true;
var htmlText = new Text(htmlContent);
htmlText.IsHtmlTagSupported = true;
section.Paragraphs.Add(htmlText);

Here is the site.css contents:

td
{
border:0 !important;
}

table.list
{
background: white !important;
border-color: #dadada !important;
border-width: 1px 1px 1px 1px !important;
border-style: solid !important;
border-collapse: collapse !important;
background-image: none !important;
width: 10.5in;
}

th.list
{
border-color: #dadada !important;
border-width: 1px 1px 1px 1px !important;
border-style: solid !important;
text-align: left !important;
font-weight: bold !important;
color: #000000 !important;
background: #cccccc !important;
padding: 5px 5px 5px 5px !important;
font-size: 9pt;
}

td.list
{
border-color: #dadada !important;
border-width: 1px 1px 1px 1px !important;
border-style: solid !important;
border-collapse: collapse !important;
padding: 5px 5px 5px 5px !important;
font-size: 9pt;
}

table.internal
{
font-size: 9pt;
}

Hi Gerald,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the sample code.

I checked HTML code you shared and it is not displaying correctly in IE-9 (some columns are cropping from the right) as well. I have a print preview screenshot for you. Which version of IE are you using that is not displaying any issue? Please share some more details about your system environment i.e. OS, x32 or x64, .NET Framework, IE etc and we will check the issue and get back to you soon.

Sorry for the inconvenience,