HTML to PDF conversion problems

Updated this post …
I am trying to fix an issue with cell text wrapping and could not get nowrap to work for saving to a PDF file. I upgraded to 11.8.1 to see if that helped and my rendering got worse.
I have tried many variation of CSS, both included as attributes and via class definition, but very little seems to work for me.
In addition to text nowrap not working, I see table border issues. In version 10.6, the following table header has just the bottom border applied to the first row of cells which worked, but after upgrading, if the border is turned on at all, you get all four borders.
Rendering in browsers seems to work all the time. I have included all code below.
Any ideas on how to fix this?

<html>
	<head>
		<title>Test Wrap</title>
		<style type="text/css">
			table {border-style: none;}
			td {padding: 2px 4px; background: #FFF;}
			td.nowrap {white-space:nowrap;}
			td.thnowrap {white-space:nowrap; border-bottom: 2px solid black; font-weight: bold;}
		</style>
	</head>
	<body style="font-family: 'Arial', 'Sans-Serif'; margin: 0px;">
		<table cellspacing="0" cellpadding="4">
			<tr>
				<td class="thnowrap">Onset Date</td>
				<td style="width: 10px;"></td>
				<td  class="thnowrap">Description</td>
				<td style="width: 10px;"></td>
				<td class="thnowrap">ICD Code</td>
				<td style="width: 10px;"></td>
			</tr>
			<tr>
				<td class="nowrap">08/17/2012</td>
				<td style="width: 10px;"></td>
				<td>History of ABNORM REACT/COMPLI D/T WHOLE ORGAN TRANSPLNT SX</td>
				<td style="width: 10px;"></td>
				<td class="nowrap">ICD-E878.0</td>
				<td style="width: 10px;"></td>
			</tr>
		</table>
	</body>
</html>
// Simplified C# shown below
var file = "test.html";
var outFile = "test.pdf";
var options = new LoadOptions(LoadFormat.Html, string.Empty, string.Empty);
var fileBytes = File.ReadAllBytes(file);
using (var sourceStream = new MemoryStream(fileBytes))
{

    var document = new Document(sourceFileStream, options);

    document.FirstSection.PageSetup.RightMargin = ConvertUtil.InchToPoint(0.25);
    document.FirstSection.PageSetup.LeftMargin = ConvertUtil.InchToPoint(0.25);
    document.Save(outFile);
}

Hi Jeff,

Thanks for your inquiry. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7171 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

Please read following documentation links for your kind reference.
https://docs.aspose.com/words/net/table-features-supported-on-html-export/
https://docs.aspose.com/words/net/table-features-supported-on-html-import/

We apologize for your inconvenience.

Thanks. I am glad you were able to reproduce it. Any estimates on the fix would be helpful for our scheduling. We would also prefer to use the inline style attribute if that makes a difference, but any fix would be good.

Hi Jeff,


Thanks for your inquiry.

Further to my last reply. I have worked again with your shared HTML and have found that there is no issue in HTML to PDF conversion except table’s border issue. Please note that the HTML layout engine of Aspose.Words tries to mimic the same behavior as MS Words do. Please find the MS Words and Aspose.Words output PDF files in attachment.
thestorms:
In addition to text nowrap not working, I see table border issues. In version 10.6, the following table header has just the bottom border applied to the first row of cells which worked, but after upgrading, if the border is turned on at all, you get all four borders.
I have managed to reproduce the border issue at my side. I have logged this issue as WORDSNET-7181 in our issue tracking system.

Regarding ETA of this issue (WORDSNET-7181), This issue is pending for analysis and is in the queue. At the moment we can not provide you the ETA for this issue. However, we will inform you via this forum thread as soon as it is resolved.

We apologize for your inconvenience.

To clarify, when you say that there are no issue in HTML to PDF conversion. Do you mean that you cannot reproduce the wrapping problem, or that WORDS just doesn’t support it yet? The support attribute page indicates that it is not supported.


We are current sticking with the older version, because of the other border related problems, but we may need to look at other alternatives, since WORDS does not support some key HTML features like nowrap. Does ASPOSE have any workarounds for this nowrap limitation?

Hi Jeff,


Thanks for your inquiry.
thestorms:
To clarify, when you say that there are no issue in HTML to PDF conversion. Do you mean that you cannot reproduce the wrapping problem, or that WORDS just doesn’t support it yet? The support attribute page indicates that it is not supported.
Please note that the HTML layout engine of Aspose.Words tries to mimic the same behavior as MS Words do. If you convert shared HTML to PDF by using MS Word, you will get the same output (open html in MS Word and save it as PDF). Please find the both output PDF files in attachment generated with Aspose.Words and MS Word.

Regarding border issue (WORDSNET-7181), I have verified the status of this issue from our issue tracking system and like to share with you that this issue has been planned for development. Hopefully, this issue will be fixed in next release of Aspose.Words.

We appreciate your patience.

I am not seeing the same behavior using MS Word 2007. I opened the attached html file in MS Word and saved as PDF. The resultant file which is also attached did not wrap the two outer columns. I have not tried MS Word 2010.

Hi Jeff,

Thanks for sharing the additional information. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-7303 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-7181) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as WORDSNET-7303) have been fixed in this Aspose.Words for .NET 23.10 update also available on NuGet.