FreeText annotations in PDF Viewer use Arial font, so when annotations are written in languages that require CJK font, they are garbled.
Is there a way to use CJK fonts in FreeText annotations?
Hi Yoshikazu ,
While entering the CJK font text some text are visible differently in free text annotation of PdfViewer.
Currently, we are checking on this issue and we will update further details on August 26th, 2022.
Regards,
Salman
Hi Yoshikazu ,
In the Syncfusion pdfviewer control , the free text annotation uses Arial font by default. You can change the font for free text annotation in default setting. We have attached the code snippet for your reference.
pdfViewer.FreeTextAnnotationSettings.FontFamily = new FontFamily("Kozuka Mincho Pr6N R"); |
After setting the default setting for free text annotation, you can add the free text box with the new font family. Please kindly ensure that your system has the particular font installed.
Please let us know whether above solution was helpful to achieve your requirement and if you need any further assistance.
Regards,
Salman
Thanks SalmanBaris!
I have tried changing the FontFamily, but it appears that the font information is not saved when I save to the PDF file after adding the FreeText annotation.
I tried the following steps.
1. clone wpf_demo
2. modified FreeText.xaml.cs in syncfusion.pdfviewerdemos demo
public FreeText(string themename) : base(themename) { InitializeComponent(); pdfviewer1.FreeTextAnnotationSettings.FontFamily = new FontFamily("Kozuka Mincho Pr6N R"); } |
3. Run pdfviewer demo and add FreeText annotations
4. Save the file from [Save As]
5. Open the PDF in Adobe Acrobat DC
When opened in Acrobat DC, font changes are not reflected.
I also confirmed that the font of the FreeText annotation is not Kozuka Minco when I exported the fdf in Acrobat DC.
Hi Yoshikazu ,
When opened in Acrobat DC, font changes are not reflected. |
We have faced the Free text box text is only visible in Question marks(?) after saving the document and open in adobe. We have attached screen shot for your reference. Please let us know whether if you have faced the same issue. We will validate this issue and update you on 1st September. |
I also confirmed that the font of the FreeText annotation is not Kozuka Minco when I exported the fdf in Acrobat DC.
|
We tried to reproduce the reported issue on our end with the provided details, and We added free text annotation with Kozuka Mincho font family in pdf document using Pdf Viewer and open the document in adobe then exported the fdf and import the fdf in new file, but we could not be able to reproduce the issue. After Import
|
Regards,
Salman
hanks SalmanBaris.
I have reproduced the series of operations in my environment.
1. change FreeText font settings in PDFViewer, add annotations and save.
2. when opened in AcrobatDC, the added annotations are not displayed. The annotation list shows the correct content.
3) Save the annotation to .fdf and check the font, it is Microsoft Sans Serif. However, this may be caused by Acrobat DC.
I am looking for a solution because I want the correct font to be displayed at the stage of 2.
Hi Yoshikazu,
We can be able to reproduce the reported issue “The Text added in the freetext annotation disappears when opened in adobe” on our end with the .NET Core demo. We will validate this issue and will update further details on 1st September 2022.
Regards,
Raja Vignesh.
Thanks SalmanBaris.
Hopefully the update will resolve the issue.
Hi Yoshikazu ,
We don’t have direct support save the custom font style for text annotation. But we can save the document with custom font style for text annotation in sample level. Please find the attached sample for your reference and code snippet in below. In this sample we are added two buttons Save and Add Free text .The Add Free text button using to add a new text box in pdf and save button using save the document. While saving the document we have iterated all the free text annotations from all the pages and embed the corresponding font file to the specific annotation. Like the same you can include other custom font also.
string fontPath = @"../../../Data/Kozuka Mincho Pr6N R.otf"; FileStream fontStream = new FileStream(fontPath, FileMode.Open); PdfLoadedDocument ldoc = pdfViewer.LoadedDocument; for (int i = 0; i < ldoc.Pages.Count; i++) { PdfLoadedPage lpage = ldoc.Pages[i] as PdfLoadedPage; for (int j = 0; j < lpage.Annotations.Count; j++) { PdfFreeTextAnnotation lAnnot = lpage.Annotations[j] as PdfFreeTextAnnotation; if (lAnnot != null) { lAnnot.Font = new PdfTrueTypeFont(fontStream, lAnnot.Font.Size); lAnnot.ComplexScript = true; lAnnot.SetAppearance(true); } } } ldoc.Save(@"../../../Data/Sample.pdf"); fontStream.Close(); |
Please let us know whether the provide solution resolve the issue and if you need any further assistance.
Regards,
Salman