Changing widget annotation name and tooltip

Hi,

I have a sample file with all types of widget annotations (Aspose.Pdf.Annotations.WidgetAnnotation) on a form. Each annotation has a name and a tooltip text, and both has to be read and/or modified in our use-case, however the only property I could find is for the name (FullName), and it is read-only.

Is there a way to:

  • Set the name somehow
  • Get/set the tooltip text

AsposeFormTooltip.zip (321.9 KB)

The attached project lists all the annotations of the sample PDF, naming each. The folder also contains screenshots of the expected names and one of the tooltips (though every field of the form has a unique tooltip text). Lastly, the program expects a license file too (otherwise the number of annotations that could be shown on the page would be limited).
I tried setting an annotation’s “Name” property, but that has a different purpose, as it adds a “/NM” key in the corresponding dictionary of the annotation in the file. I’m looking for full access to “/T” and “/TU”.

Thanks in advance for your support!

@psimon

We tried to use the below code snippet but it only changed the names of the fields. We could not find the tooltip property to change it:

using var doc = new Document("AnnotationTitleAndTooltipTest.pdf");

foreach(var field in doc.Form.Fields)
{
    Console.Out.WriteLine(field.FullName);
    field.Name = DateTime.Now.Millisecond.ToString();
}

Therefore, an issue as PDFNET-51920 has been logged in our issue tracking system. We will further look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Thank you for the quick response!

Unfortunately setting the “Name” property of “Aspose.Pdf.Forms.Field” does exactly the same thing as in case of “Aspose.Pdf.Annotations.WidgetAnnotation”, probably because it is a subclass of “WidgetAnnotation” inheriting “Name” as-is. I.e. “FullName” remains the same.

So on top of providing a property for the tooltip, could you please include having write access for “FullName” on this (or on a separate) ticket?

I also tried and added your code snippet, and it clearly shows that “FullName” is unchanged. Here is my program’s output before:

'Widget' on page 1 at (URX=442.48; URY=442.48) - FullName:'Text field name'          Name:''
'Widget' on page 1 at (URX=338.61; URY=338.61) - FullName:'Check box name'           Name:''
'Widget' on page 1 at (URX=369.82; URY=369.82) - FullName:'Radio button group name'  Name:''
'Widget' on page 1 at (URX=369.82; URY=369.82) - FullName:'Radio button group name'  Name:''
'Widget' on page 1 at (URX=369.82; URY=369.82) - FullName:'Radio button group name'  Name:''
'Widget' on page 1 at (URX=344.15; URY=344.15) - FullName:'List box name'            Name:''
'Widget' on page 1 at (URX=443.78; URY=443.78) - FullName:'Dropdown name'            Name:''
'Widget' on page 1 at (URX=334.55; URY=334.55) - FullName:'Button name'              Name:''
'Widget' on page 1 at (URX=456.62; URY=456.62) - FullName:'Image field name'         Name:''
'Widget' on page 1 at (URX=394.16; URY=394.16) - FullName:'Date field name'          Name:''
'Widget' on page 1 at (URX=394.54; URY=394.54) - FullName:'Signature field name'     Name:''
'Widget' on page 1 at (URX=501.23; URY=501.23) - FullName:'Barcode name'             Name:''

… and after applying your suggestion:

Button name
Dropdown name
List box name
Radio button group name
Radio button group name
Radio button group name
Check box name
Text field name
Image field name
Date field name
Signature field name
Barcode name
'Widget' on page 1 at (URX=442.48; URY=442.48) - FullName:'Text field name'          Name:'551'
'Widget' on page 1 at (URX=338.61; URY=338.61) - FullName:'Check box name'           Name:'551'
'Widget' on page 1 at (URX=369.82; URY=369.82) - FullName:'Radio button group name'  Name:'551'
'Widget' on page 1 at (URX=369.82; URY=369.82) - FullName:'Radio button group name'  Name:'551'
'Widget' on page 1 at (URX=369.82; URY=369.82) - FullName:'Radio button group name'  Name:'551'
'Widget' on page 1 at (URX=344.15; URY=344.15) - FullName:'List box name'            Name:'551'
'Widget' on page 1 at (URX=443.78; URY=443.78) - FullName:'Dropdown name'            Name:'551'
'Widget' on page 1 at (URX=334.55; URY=334.55) - FullName:'Button name'              Name:'550'
'Widget' on page 1 at (URX=456.62; URY=456.62) - FullName:'Image field name'         Name:'551'
'Widget' on page 1 at (URX=394.16; URY=394.16) - FullName:'Date field name'          Name:'551'
'Widget' on page 1 at (URX=394.54; URY=394.54) - FullName:'Signature field name'     Name:'551'
'Widget' on page 1 at (URX=501.23; URY=501.23) - FullName:'Barcode name'             Name:'551'

@psimon

Another enhancement request as PDFNET-51920 has been logged in our issue management system. We will surely consider it and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.