We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Euro sign culture setting in PdfDocument

Thread ID:

Created:

Updated:

Platform:

Replies:

140836 Nov 9,2018 02:06 PM UTC Nov 15,2018 09:45 AM UTC Xamarin.Android 9
loading
Tags: PDF
Vince
Asked On November 9, 2018 02:06 PM UTC

Hi,

In my app I use PdfGrid's to show text in a pdf file. In the cells I also must add text with a culture currency like:

            var pdfGridParagraph3 = new Syncfusion.Pdf.Grid.PdfGrid();
            pdfGridParagraph3.Columns.Add(1);
            pdfGridParagraph3.Columns[0].Width = 200;
            var pdfGridRowParagraph3Details1 = pdfGridParagraph3.Rows.Add();
            pdfGridRowParagraph3Details1.Cells[0].Value = "€ 200.000";

Unfortunetly the Euro sign is not visible in the created pdf file.

Do you have a solution?

KarthikeyanC [Syncfusion]
Replied On November 12, 2018 05:06 AM UTC

Hi Vince, 
By default PdfGrid uses Standard Font to draw the text in the PDF document. As Euro is a Unicode character we have to use True Type font to get this supported. Please use the below code snippet to get this issue resolved. 
Stream fontStream = typeof(MainPage).GetTypeInfo().Assembly.GetManifestResourceStream("Sample.Assets.Arial.ttf"); 
pdfGridParagraph3.Style.Font = new PdfTrueTypeFont(fontStream, 14); 
Note: The TTF file should be placed in the Xamarin application. 

Revert me back if you need further assistance in this. 
Regards, 
Karthikeyan  


Vince
Replied On November 12, 2018 08:15 AM UTC

Hallo Karthikeyan,

I saw this code snipped before but was not able to implement it.

Do you have a working example for Xamarin Android?

Best regards,

Vince

KarthikeyanC [Syncfusion]
Replied On November 12, 2018 10:29 AM UTC

Hi Vince, 
Please find the simple sample below. 
Regards, 
Karthikeyan  


Vince
Replied On November 12, 2018 11:51 AM UTC

Hallo KarthikeyanC,

I see that I was missing the reference "using System.Reflection;" in my app. 

But still it is not working because your code line "Stream fontStream = typeof(MainActivity).GetTypeInfo().Assembly.GetManifestResourceStream("GettingstartedAndroid.Assets.Arial.TTF");" returns the next error:

Unhandled Exception:
System.ArgumentNullException: Value cannot be null.
Parameter name: fontStream

Do you know what is going wrong?

Best regards,

Vince
p.s. the file "Arial.TTF" is available in the map Assets of my app.

KarthikeyanC [Syncfusion]
Replied On November 13, 2018 12:44 PM UTC

Hi Vince, 
Thank you for your update. 
We are suspecting the font file (arial.ttf) build action is not set as Embedded Resource. So, the font stream becomes null and the null reference exception throws when try to accessing. 

Kindly check, step 7 from below KB to mark the font file as Embedded Resource. 

Please try our suggestion and let us know If you need further assistance in this. 
Regards, 
Karthikeyan  


Vince
Replied On November 13, 2018 01:21 PM UTC

Hi KarthikeyanC,

I changed the Build Action of the file Arial.ttf to Embedded Resource as you mentioned. Unfortunetly the error (null reference for fontStream) is still there.

Do you have another tip?

KarthikeyanC [Syncfusion]
Replied On November 14, 2018 03:59 PM UTC

Hi Vince, 
Thank you for your update. 
Can you please confirm, is the sample which we have provided on November 12, 2018 10:29 AM UTC in the forum is it working fine in your end?. The stream for the Arial.ttf font file can be retrieved using below code snippet. 
 
Stream fontStream = typeof(MainActivity).GetTypeInfo().Assembly.GetManifestResourceStream("GettingstartedAndroid.Assets.Arial.ttf"); 
 
 
 
Please find the font file path of GetManifestResourceStream parameter 
GettingstartedAndroid  - Name of the sample 
Assets                            - Folder name 
Arial.ttf                          - Font file name 
 
 
Make sure the GetManifestResourceStream parameter set properly. 
Regards, 
Karthikeyan 


Vince
Replied On November 14, 2018 04:34 PM UTC

Hi KarthikeyanC,

Unfortunetly not. 

The GetManifestResourceStream is set with the correct namespace although it is already available in my class.

I also can not run your sample because I get an error (not enough memmory available).

So I still have no Euro sign in my pdf report.

Best regards,

Vince.



KarthikeyanC [Syncfusion]
Replied On November 15, 2018 09:45 AM UTC

Hi Vince, 
We have created a new incident for further followup in this issue, can we have a web meeting to address this issue. Please follow the incident which is created under your account to get further information. 

Regards, 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;