Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.
Tue Oct 11, 2016 3:22 pm
I am using
- Code: Select all
page.Canvas.DrawString("Δ eě sš cč rř zž yý aá ií eé uú uů", new PdfFont(PdfFontFamily.Helvetica, 20f), new PdfSolidBrush(Color.Black), 0, 0, new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle));
this code should generate string starting with "delta character", but the result is:
- Code: Select all
? eì sš cè rø zž yý aá ií eé uú uù
instead of:
- Code: Select all
Δ eě sš cč rř zž yý aá ií eé uú uů
what is wrong?
Thanks in advance for your help.
-

Kubik
-
- Posts: 7
- Joined: Tue Oct 11, 2016 3:10 pm
Wed Oct 12, 2016 3:10 am
Dear Kubik,
Thanks for your inquiry.
Please try to use the method PdfTrueTypeFont(Font font, bool unicode) to create the font, the unicode characters can be displayed correctly.
- Code: Select all
page.Canvas.DrawString("Δ eě sš cč rř zž yý aá ií eé uú uů", new PdfTrueTypeFont(new Font("Arial", 30f), true), new PdfSolidBrush(Color.Black), 0, 0, new PdfStringFormat(PdfTextAlignment.Left, PdfVerticalAlignment.Middle));
Sincerely,
Nina
E-iceblue support team
-


Nina.Tang
-
- Posts: 1385
- Joined: Tue Sep 27, 2016 1:06 am
Wed Oct 12, 2016 7:47 am
Very thanks.
It worked like a charm.
-

Kubik
-
- Posts: 7
- Joined: Tue Oct 11, 2016 3:10 pm
Wed Oct 12, 2016 8:03 am
Dear Kubik,
Thanks for your feedback. Please feel free to contact us if you have any questions and requests.
Sincerely,
Nina
E-iceblue support team
-


Nina.Tang
-
- Posts: 1385
- Joined: Tue Sep 27, 2016 1:06 am
Mon May 06, 2019 1:21 pm
Hello,
Can I make those characters bold?
This is my attempt, but it doesn't work for me:
- Code: Select all
PdfTrueTypeFont fontBold = new PdfTrueTypeFont(new Font("TimesRoman", 8f, FontStyle.Bold), true);
-

jtibiFeria
-
- Posts: 4
- Joined: Fri May 03, 2019 12:19 pm
Tue May 07, 2019 11:48 am
Dear Jasmina,
Thanks for your inquiry.
I indeed found that the bold style didn't take effect while using your code. The issue is related to the font "TimesRoman" you used, if you use another font like "Arial", the bold style could be set successfully. Below is my testing code. Besides, I have posted the "TimeRoman" font to our Dev team for further investigation. If there is any update, I will let you know.
- Code: Select all
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
page.Canvas.DrawString("Δ eě sš cč rř zž yý aá ií eé uú uů", new PdfTrueTypeFont(new Font("Arial", 8f, FontStyle.Bold), true),PdfBrushes.Black,new PointF(100,100));
doc.SaveToFile("result.pdf", FileFormat.PDF);
Sincerely,
Nina
E-iceblue support team
-


Nina.Tang
-
- Posts: 1385
- Joined: Tue Sep 27, 2016 1:06 am
Fri May 10, 2019 4:59 am
Hi,
After further investigation, we found actually the name of TimesRoman font is "Times" rather than the "TimesRoman ". Please correct the font name as follows in your code, then the bold style will be set successfully. Please have a test. Just feel free to write back if there is any question.
- Code: Select all
PdfTrueTypeFont fontBold = new PdfTrueTypeFont(new Font("Times", 8f, FontStyle.Bold), true);
Sincerely,
Nancy
E-iceblue support team
-


nancy.yang
-
- Posts: 184
- Joined: Wed Apr 03, 2019 2:33 am
Fri May 10, 2019 9:39 am
You are right, this solved my problem.
Thank you.
-

jtibiFeria
-
- Posts: 4
- Joined: Fri May 03, 2019 12:19 pm
Mon May 13, 2019 1:21 am
Hi,
Thanks for your feedback.
If there is anything we can do for you in the future, please do not hesitate to contact us.
Wish you all the best!
Sincerely,
Nancy
E-iceblue support team
-


nancy.yang
-
- Posts: 184
- Joined: Wed Apr 03, 2019 2:33 am