Symbols in PDF

Hello


In a blazor project I'm uploading a txt file which should be merged as pdf with other pdf doc. In it it contains special chars like micro sign and degree sign

so a couple of lines are like so:

Sampling speed: 5.0 µL/s

Cooler temperature: 5 °C

Temperature control - Rack plate L: Yes

Temperature control - Rack plate M: Yes

Temperature control - Rack plate R: Yes

Use air gap volume: No

--------------------------------------------

Problem is despite that I'm using arial-unicode-ms.ttf in PDF ​the above mentioned chars cannot be displayed correctly, but with ? signs (see image). Any ideas? (The aforementionied ttf is consumed as a stream as seen in Syncfusion samples)

data is stored on SQL as varbinary(max), related PDF code is like so:

Snippet
string result = string.Empty;
 
                using (StreamReader reader = new StreamReader(new MemoryStream(method.Data), detectEncodingFromByteOrderMarks: true))
                {
                    result = reader.ReadToEnd();
                }
 
                PdfTextElement element = new PdfTextElement(result);
                element.Font = font;
                element.Draw(document.Pages[0], new PointF(0,0));                            
                
                document.Save(finalstream);                





Attachment: sample_c2cb77d7.rar


2 Replies 1 reply marked as answer

GE Gergo October 18, 2021 12:24 PM UTC

Should anyone need it:

It turned out that I needed to explicitly specify the codepage like so(1252), this way it is now able to display symbols

Snippet
using (StreamReader reader = new StreamReader(new MemoryStream(method.Data), Encoding.GetEncoding(1252), false))
                {
                    result = @reader.ReadToEnd();
                }

Marked as answer

AA Anitha Azhagesan Syncfusion Team October 19, 2021 08:57 AM UTC

Hi Gergo, 
  
Thanks for the update. Please let us know if you require any assistance from us. 
  
Regards, 
Anitha 


Loader.
Up arrow icon