How to use FreeText Annotation in Android?

You may be want to add a text on your pdf. Now, you can do that by using a FreeText Annotation in the PlugPDF version 2.9.29 or later.

In another post, we already introduced how to use annotation tool at the “PDF Annotation Tools“. You can easily add other annotations, but in the case of FreeText annotations, there is something that you need to know more because of a font.

So, we will see a simple way how to use a FreeText Annotation and look at things to be aware of when using it.

To use FreeText Annotation

You just need to add the below code to use it.

The “PDF Annotation Tools” post give you more information about using annotations in your pdf.
Please visit the post for more information.

To set options for FreeText Annotation.

Use AnnotSetting.instance() to control the color, transparency, text size, and font of the FreeText Annotation.
The below code snippet sample will help you to set options.

Things to keep in mind when setting fonts

  • Please set a map from a font name used in the setFreeTextFont method to font file name.
    The below code snippet sample will help you know how to set the map.
  • You can only use the system fonts or the fonts located in src/main/assets/Fonts.
  • To show character in FreeText, the font you set should have the glpyh information of the character.

The below picture show a pdf added in FreeText Annotation.
Screen Shot 2017-02-20 at 11.46.07 AM

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *