Font Properties on PdfTextAnnotation

Questions, comments and suggestions concerning VintaSoft PDF .NET Plug-in.

Moderator: Alex

Post Reply
IntegraMike
Posts: 56
Joined: Mon Dec 02, 2019 11:19 pm

Font Properties on PdfTextAnnotation

Post by IntegraMike »

I'm trying to allow for different font properties to be set on replies to annotations, but there doesn't appear to be a way to save the updated font data to the text annotation. As a result I can't have one user save their reply with one set of font settings and another reply with a different set later on. Is there a way you would suggest doing this?
Alex
Site Admin
Posts: 2307
Joined: Thu Jul 10, 2008 2:21 pm

Re: Font Properties on PdfTextAnnotation

Post by Alex »

Hi Mike,

The PdfAnnotationComment class uses the PdfTextAnnotation class as the data source.

For solving your task you can go by 2 ways.

WAY 1. Store formatted text in "Adobe XML Architecture, XML Forms Architecture (XFA) Specification" format in the PdfTextAnnotation.RichText property.
For doing this you need to:
  • Create an algorithm that encodes formatted text into XFA format.
  • Create an algorithm that decodes formatted text from XFA format.
  • Create custom class, which is derived from PdfAnnotationComment class, get PdfTextAnnotation using PdfAnnotationComment.Annotation property and store formatted text in the PdfTextAnnotation.RichText property. SDK does not use and does not interpret the PdfTextAnnotation.RichText property.
  • Change the control, which displays the comment text.
WAY 2. Store information about font name and font size in custom properties of PdfTextAnnotation.
  • Create custom class, which is derived from PdfAnnotationComment class, add new properties (FontName, FontSize) to the class and store information about text font in new properties. New properties will be stored in metadata of PDF text annotation in PDF tree.
  • Change the control, which displays the comment text.
Both ways need to do changes in SDK. Changes will be available in next minor version.

Best regards, Alexander
Alex
Site Admin
Posts: 2307
Joined: Thu Jul 10, 2008 2:21 pm

Re: Font Properties on PdfTextAnnotation

Post by Alex »

Hello Mike,

In version 9.0.0.21 we have added the ability to create classes, which are derived from PdfAnnotationComment and PdfAnnotationCommentCollection classes. This allows to implement logic, which is necessary in your task.

Best regards, Alexander
IntegraMike
Posts: 56
Joined: Mon Dec 02, 2019 11:19 pm

Re: Font Properties on PdfTextAnnotation

Post by IntegraMike »

Awesome, thank you! I'll start taking a look at that.
Post Reply