Could you please share your sample HTML string with us along with sample code snippet that you are using to generate PDF document. We will test the scenario in our environment and address it accordingly.
We have tested the scenario using following code snippet and Aspose.PDF for .NET 21.1. We did not notice any issue. Please check attached source and output PDF for your reference:
Document myDocument = new Document();
Page page = myDocument.Pages.Add();
HtmlFragment html = new HtmlFragment(File.ReadAllText(dataDir + "PercedingLine.html"));
page.Paragraphs.Add(html);
myDocument.Save(dataDir + "htmlFragment.pdf");
The archive includes only executables. It does not have a complete Visual Studio project with code files. Please try to share a sample Visual Studio project which we can run at our end and observe the issue.
We have tested the scenario in our environment and found that the issue was due to a larger font size i.e. 14. This can be prevented by either reducing the margins or the font size. You can also put a <br> tag before the word “from” which will cause it to break to the next line along with the symbol:
Due to accessibility guidelines we are restricted to use these sizes for our font and margins when producing documents. If we were allowed to change the font or margins this would resolve this instance of the issue but would not stop it from happening again.
Adding the br tag before the “from” would resolve this scenario however when building our pdfs not all emdashes end against the margin and we have no way of identifying when a emdash is going to hit the margin.
I have tried wrapping the “from” and emdash in a span and adding the style white-space and this works in a html editor but does not seem to be supported by aspose
(Sorry for the image i dont know how to add html code without it formatting)
We have logged an investigation ticket as PDFNET-49343 in our issue tracking system for the sake of your requirements. We will look into its details and keep you posted with the status of ticket resolution. Please be patient and spare us some time.
We are afraid that the ticket is not yet investigated. Please note that it was logged recently under normal support model and will be investigated/fixed on a first come first serve basis. We will surely update you as soon as we have some definite updates regarding its resolution. Please give us some time.
The issue has been scheduled for an investigation and as soon as it is fully investigated, we will be in a position to share some ETA regarding its fix. We will surely inform you once it is completely analyzed. Please be patient and give us some time.
We have made an investigation against the logged ticket and found that you can use &NoBreak keyword in the HTML which will be supported by Aspose.PDF. Please try to use the template like the attached HTML and let us know in case you need further assistance.