Ordered/Unordered html fragment throwing exception

Hello,

I am using attached XML for generating PDF which contains Html fragment. But it is throwing exception that li type does not exist.



I tried same code for Legacy generator too their also it fails.



But when I give same html string through Api/coding it works.

Hi Sameer,


Thanks for your inquiry. Please find attached sample XML for creating Ordered/Unordered list, hopefully it will help you to accomplish your task.

Please feel free to contact us for any further assistance.

Best Regards,

Hello is their any way to add mathmatical symbols in text segment/fragment. I want to add mathmatical symbols as highlighted in attached image.

Hello XML given by you is not working it is throwing same exception that li type is not present.

Could you please share the code for the same.

I am using version 17.1.0 for this.

Hi Sameer,

Thanks for your inquriy. You may use supported font to add mathematical symbols. Please check following sample code snippet, hopefully it will help you to accomplish the task. However if there is some difference in your requirement and my understanding, then please share some more details.

TextState ts = new TextState();
ts.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");
ts.FontSize = 12;

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
Page page = doc.Pages.Add();

TextFragment frag1 = new TextFragment();
frag1.IsInLineParagraph = true;

TextSegment segment1 = new TextSegment("This is a test. ");
segment1.TextState = ts;
frag1.Segments.Add(segment1);

TextSegment segment2 = new TextSegment(" Sample equation: ");
segment2.TextState = ts;
frag1.Segments.Add(segment2);

TextSegment segment3 = new TextSegment("∀(x, y ∈ A ∪ B; x ≠ y) x² − y² ≥ 0.");
segment3.TextState.Font = FontRepository.FindFont("Arial Unicode MS");
segment3.TextState.FontSize = 12;
segment3.TextState.FontStyle = FontStyles.Bold;
frag1.Segments.Add(segment3);

page.Paragraphs.Add(frag1);
doc.Save(myDir + "TextFragment.pdf");

Best Regards,

Hi Sameer,

I am using following code snippet and unable to notice any issue, sample output is attached for your reference. Please share your sample code and error details, so we will look into the issue and will guide you accordingly.

Aspose.Pdf.Document doc = new Aspose.Pdf.Document();
doc.BindXml(myDir + "NewDOM_List.xml");
doc.Save(myDir+"XMLtoPDF_List.pdf");

Best Regards,

Hello Tilal,
Please go through the question on the following link.

Hi Sameer,


Thanks for your feedback. Please find attached updated XML, it is working fine at my end.

Please feel free to contact us for any further assistance.

Best Regards,