<< Click to Display Table of Contents >> Navigation: Create a PDF Editor > Delphi Example > Modify Annotation properties |
With WPViewPDF PLUS it is also possible to modify a selection of properties of the currently selected annotations.
There is not a GUI for this, but you can implement one which works with XML data.
xmlstring := WPViewPDF.CommandGetStr(COMPDF_Ann_XMLGetFromAnnots, '###', 0);
will retrieve a string with the properties of all selected annotations. The properties which have different values in the selection will be set to '###'.
All property values can be modified in the XML code, also the '###' placeholders and then applied to the selection:
WPViewPDF.CommandStrEx(COMPDF_Ann_XMLSetToAnnots, modified_xmlstring, 0);
Example of the XML code of a highlight annotation:
<?xml version="1.0" encoding="utf-8"?>
<neutral value="###"></neutral>
<annot X="58.80" Y="120.27" W="492.43" H="48.11" GrOptions="64"
Background-Color="blue" prp.n.Subtype="Highlight"
Color="Yellow" Alpha="50"></annot>
You can modify X, Y, W and H - all are measured in 72dpi and also Color and Alpha.
Background color is: Background-Color="color_as_string"
Line color is: Color="color_as_string"
Font name is: Font="fontname"
Font Size color is: Font-Size="floatvalue"
Font color is: Font-Color="color_as_string"
COMPDF_Ann_XMLSetToAnnots will modify all named properties, except for those with the value '###'. Note, that you can use a different token instead of '###'.
It is also possible to change the acroform field properties. The acroform fields are connected to widget annotations only. Of widget annotations are selected COMPDF_Ann_XMLGetFromAnnots can be used to retrieve the XML data and COMPDF_Ann_XMLSetToAnnots can be used to apply it.
Example of the Acroform Field XML code:
<?xml version="1.0" encoding="utf-8"?>
<neutral value="###"></neutral>
<field T="undefined" TU="undefined" F="4" V="" FT="Tx"></field>
T is the fieldname, TU the alternative field name to be displayed in gui.
F are the field flags (see PDF specs), V the current field value and FT the field type. The type can be Tx or Btn for a checkbox.