Aspose.pdf for .NET Exception

Hi,

When I create a PDF file with following HTML text, I got an exception. See the detailed info below. Any ideas?

My HTML text is as follows:

<p class="MsoNormal" style="margin: 0in 0in 0pt;"><span style="font-family: "Trebuchet MS";"><span style="font-size: small;">No information available.</span></span></p>


Exception:

System.ApplicationException was unhandled by user code
Message="The Font '&quot' is not found. This font is not supported."
Source="Aspose.Pdf"
StackTrace:
at ..( , String , String , Int32 , Boolean , Boolean , String , Boolean )
at ..(String , String , Int32 , Boolean , Boolean , String , Boolean )
at „..(Text , Pdf , )
at „..€(Pdf , Section , Table , Row , Cell , Text , , , Boolean )
at „..(Pdf , Section , HeaderFooter , Table , Row , Cell , Text , , , Boolean )
at ƒ..(Pdf , Section , Table , Row , Cell , , )
at „..(Pdf , Section , Table , Row , , )
at „..(Pdf doc, Section currentPart, HeaderFooter hf, Table table, assignInfo, useType, Boolean isFirst, & breakTableNextPart)
at „..(Pdf , Section , )
at ƒ..(Pdf )
at ƒ..( , Pdf )
at Aspose.Pdf.Pdf.Save(String pdfFile)
InnerException: System.ApplicationException
Message="Font '&quot' not found. Please make sure the customer font file is correctly set."
Source="Aspose.Pdf"
StackTrace:
at ..( , String , String , Boolean )
at ..( , String , String , Int32 , Boolean , Boolean , String , Boolean )
at ..( , String , String , Int32 , Boolean , Boolean , String , Boolean )
InnerException:

Thanks

Rose

Hello Rose,

Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 4.9.0 while using the code snippet shared over HTML to PDF using InLineHTML with the HTML string that you have shared and I am unable to notice any problem. Can you please share the complete code snippet that you are using so that we can try using it at our end. We apologize for your inconvenience.

codewarior:

Hello Rose,

Thanks for using our products.

I have tested the scenario using Aspose.Pdf for .NET 4.9.0 while using the code snippet shared over HTML to PDF using InLineHTML with the HTML string that you have shared and I am unable to notice any problem. Can you please share the complete code snippet that you are using so that we can try using it at our end. We apologize for your inconvenience.

I did not use InLineHTML.

Here is the code to reproduce the problem. The last line hit the problem:

Pdf pdf1 = new Pdf();

Section sec1 = pdf1.Sections.Add();

Table tab1 = new Table();

tab1.ColumnWidths = "500";

tab1.BackgroundColor = new Color(190, 190, 190);

sec1.Paragraphs.Add(tab1);

tab1.Border = new BorderInfo((int)BorderSide.All, 1F);

Row row1 = tab1.Rows.Add();

Cell cell1 = row1.Cells.Add();

Text text = new Text("

No information available.

");

text.IsHtmlTagSupported = true;

cell1.Paragraphs.Add(text);

cell1.VerticalAlignment = VerticalAlignmentType.Center;

cell1.Alignment = AlignmentType.Center;

pdf1.Save(outputFilePath + "Try" + "_" + Session.SessionID + ".pdf");

Hello Rose,

Thanks for sharing the information.

I have tested the scenario and as per my observations, the issue is occurring because of text " inside HTML string. I have updated the source HTML and the PDF document is properly being generated. The resultant PDF that I have generated is in attachment, please take a look.

Text text = new Text("

No information available.

");

In case you still face the problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

PS, I don't have Trebuchet MS font, so I have used Arial for the testing purpose.

The HTML string was generated when the user copied and pasted some formated text from MS Outlook or MS Word into our webform, and it is stored in database. It is displayed very well on our webform. Only when generated PDF file using Aspose.pdf for .NET, at the last step when I saved the file, it crashed.

Is it possible that the exception is caught in the Aspose.pdf as there is no problem when we displayed it in our webform.

Rose

Hello Rose,

I have logged this problem as PDFNET-23708 in our issue tracking system. We will further look into the details of this problem and will keep you updated with the status of correction. Please be patient and spare us little time. We apologize for your inconvenience.

codewarior:

Hello Rose,

I have logged this problem as PDFNET-23708 in our issue tracking system. We will further look into the details of this problem and will keep you updated with the status of correction. Please be patient and spare us little time. We apologize for your inconvenience.

Has the bug PDFNET-23708 been fixed? I reported it 19 months ago. I tried the latest version Aspose PDF.net Ver. 7.2.0 today. The problem still exists.

Please let me know when it will be fixed?

Rose

Hello Rose,


Thanks for your patience.

As I have shared earlier, the problem is occurring because of text " inside HTML string. Please note that entities cannot be used in a style definition as it’s an incorrect approach. Nevertheless, I have requested the development team to further look into this matter and determine if we can add some support for such scenario in our product. As soon as I have some updates, I would be more than happy to update you with the status of correction.

We are really sorry for this delay and inconvenience.