Text wrapped in HtmlFragment is cutting off randomly in PDF

We are using Aspose Version 22.10.0 for PDF generation for our .NET Application.

Initially we faced an issue (boxed appeared instead of the foreign text) while putting foreign texts directly in the Aspose Table>Row>Cell.

Eg. row.Cells.Add(“บริษัท คอนแทค-อิน-วัน จำกัด”);

We found in the Aspose forum,this issue can be resolved by using HtmlFragment.
So we fixed that issue by wrapping the foreign text/normal text in a HtmlFragment.

That really worked, we could see the foreign texts in the PDF.
Now, we have come across two strange issues,

  1. any text wrapped in a HtmlFragment are randomly cutting-off.

  2. Taking huge memory if the given text is large in the HtmlFragment.

In the below snap, you can see that the name “Bradford T Williams, Md, Pa” is appearing perfectly in the 54th page of the PDF,
aspose1.JPG (73.6 KB)

However, the same name is cutting off in the 183th page of the PDF,

If we put the “Bradford T Williams, Md, Pa” name directly in the cell (ie. row2.Cells.Add(Program.GetHtmlCellContent(“Bradford T Williams, Md, Pa”));),

then it is working, but in that case there might be an issue if the name appears in any foreign languages.

aspose2.JPG (56.3 KB)

I have added this GetHtmlCellContent method to get a table cell containing any normal text or foreign text.
public static Cell GetHtmlCellContent(string s)
{
HtmlFragment htmlFragment = new HtmlFragment(s);
Cell c = new Cell();

        c.Paragraphs.Add(htmlFragment);
        return c;
    }

// row.Cells.Add(GetHtmlCellContent(“บริษัท คอนแทค-อิน-วัน จำกัด”));
row.Cells.Add(GetHtmlCellContent(“Brbdford T Wklliams, Md, Pa”));
tbl.Rows.Add(row);

Request you to help me here to get the solution for these above mentioned issues.

Thanks,
Finomial Dev Team

@finomial_software_team

First of all, if you are facing an issue where non-English characters are rendering as blocks, you should install required fonts in the system which support these characters. Using HtmlFragment is not an reliable solution for this issue. It is more like a workaround. HtmlFragment is only supposed to use when you want to render an HTML string inside PDF.

Furthermore, please share with us the complete sample code snippet that we can use to generate a table and reproduce the similar issue that you are facing. We will test the scenario in our environment and address it accordingly.

PS: Please use Aspose.PDF for .NET 23.4 version before sharing the requested information.