We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

FreeTextAnnotation Font Styles (Bold- Italics) not working

I am using the Aspose.Examples.CSharp solution, using version 10.5.1.0 of Aspose.PDF for .NET
I am running the SetFreeTextAnnotationFormatting.cs example.

I have found that trying to use Bold and/or Italicized fonts with FreeTextAnnotations are not working.

I instantiate an Aspose.Pdf.Text.Font object using Aspose.Pdf.Text.FontRepository.FindFont, which is able to successfully find the Calibri Bold Italic font.

I use that font to instantiate an Aspose.Pdf.InteractiveFeatures.DefaultAppearance object, which is successful.

I add a FreeText Annotation to the PDF document using this DefaultAppearance object, and this is successful.

However, when I view the output PDF, the font color, size, and type is correct (Calibri), but it is not Bold or Italic.

If I export that FreeText Annotation as XFDF, I can see that the defaultstyle element of that FreeText annotation is set to "font: Calibri Bold Italic 28pt;color: #ff0000".

According to my research, the defaultstyle element in XFDF uses CSS attributes. According to the CSS spec, this should be "font: italic bold Calibri 28pt;color: #ff0000". I am guessing this is the cause of the issue, that the code adding the FreeText annotation is not correctly formatting the contents of the defaultstyle element.

I have found that If I manually change the xfdf to match the CSS specification, and use ImportAnnotationFromXfdf from Aspose.Pdf.Facade.PdfAnnotationEditor, then the font is displayed correctly, as bold and italic.

I have attached the code I am running, the input and output pdfs, as well as an .xml file contatining the exported xfdf of the annotation.

Thanks!

Hi Sam,


Thanks for your inquiry. It seems you are getting issue due to evaluation version. I have tested the scenario with a license implementation and unable to notice the issue. Please make a request of 30 days temporary license and apply it, it will resolve the issue.

Please feel free to contact us for any further assistance.

Best Regards,