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,
-
any text wrapped in a HtmlFragment are randomly cutting-off.
-
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