This short guide explains how to add tooltip in PDF using C#. It has details to set the IDE, a list of steps, and a sample code to add a PDF mouseover popup text using C#. In the given sample code, a tooltip is added for a TextBox; however, you may add it for other controls as well.
Steps to Create PDF Tooltip using C#
- Set the environment to use Aspose.PDF for .NET to add a tooltip to a PDF
- Create a new PDF file using the Document class
- Add a page to the Pages collection of the newly created PDF file
- Define a rectangle for displaying the tooltip text
- Insert a text box field in the above area with some text in it
- Use the AlternateName to add a tooltip message
- Remove the border of the field to make it seamless
- Add the field to the PDF form page and save the output
These steps summarize the process of working with PDF hover text using C#. Create or load a PDF file into a Document object, add an empty page to it, define a rectangular area where the tooltip is to be placed, and create a TextBoxField. Add the tooltip as an AlternateName in the TextBox field, set its border and other properties, and add it to the Form in the loaded PDF before saving on the disk.
Code to Create Tooltip in PDF using C#
This code demonstrates programming with Adobe Acrobat tooltip using C#. You can customize the control border and background area, such as adding a tooltip anywhere on the PDF. All the form controls provide the tooltip feature, such as TextBoxField, ButtonField, RadioButtonField, ComboBoxField, etc., and for annotations, you can add a tooltip as a pop-up message using the properties contents, titles, or subject.
This article has guided us to add a tooltip in a PDF file. To remove highlights from a PDF file, refer to the article Remove Highlight from PDF using C#.