I would like to trigger another critical issue for us, on cases we use a mix text + unsupported emojis.
In those cases the text itself also is invalid and all charterers are replaced with a empty squares in the pdf.
For example this string in Hebrew.
string tempText = “סרט: ”;
will be output to the pdf as: :
While this one, that is using English text will be written much better:
string tempText = “movies: ”;
will be output to the pdf as: movies:
When removing the emoji from the string all is working well:
string tempText = “סרט:”;
will be output correctly to the pdf as: סרט:
I used both ‘Segoe UI Emoji’ and ‘Arial’ fonts and received the same problematic results.
Below is a simple code that generate easily the issue:
static void AddSimpleText()
string dataDir = RunExamples.GetDataDir_AsposePdf_Text();
Document pdfDocument = new Document();
Page page = pdfDocument.Pages.Add();
TextBuilder builder = new TextBuilder(page);
string not_validE = “סרט: ”;
TextFragment textFragment1 = new TextFragment(not_validE);
textFragment1.Position = new Position(100, 700);
textFragment1.TextState.FontSize = 15;
textFragment1.TextState.Font = FontRepository.FindFont(“Arial”);
pdfDocument.Save(dataDir + “Emoji.pdf”);
The issue when using Hebrew chars is a blocker for us, because it seems like when a single unsupported symbol is used (e.g. ), nothing in the string will be output correctly to the pdf (not only the unsupported item).
i played a little more and I think I I know why when using Hebrew text, all output is not displayed correctly. It seems like when you encode a string that has unsupported symbols, you change the selected font (e.g. Ariel) to a fallback font that doesn’t support Hebrew language (MSGothic) and this is why Hebrew is also not displayed (you are doing the same when using English text but the fallback font does support this language and this is why it’s displayed correctly).
Can you please advice if there’s a workaround or a different way to implement this