<< Click to Display Table of Contents >> Navigation: Tasks > Internal Actions > Modify color of annotation |
Annotations are created by this actions:
DrawAnnotHighlightText with the defaults "Color=Yellow","Alpha=50"
DrawAnnotBlackText, "Color=Black","Alpha=255"
DrawAnnotHighlight, "Color=Yellow","Alpha=50"
DrawAnnotFrame, "Color=Red","Alpha=255"
Using the string parameter other parameters can be passed if required. The default will only be used, if the string parameter is empty.
To modify the currently selected annotations the command COMPDF_Ann_ModifyAddProps can be used.
It expects a string parameter which holds the parameter and an integer parameter.
The integer is a bit field:
1 : modify the "current" attributes. This attributes are used by the currently active action or "Draw mode".
2 : modify the attributes of the currently selected annotations - mode 2.
4 : Auto Mode: If annotations are selected, they will be modified. If nothing is selected, the "current" attributes are modified.
8 : If the current attributes are changed, also change the defaults for the highlight, frame and freetext actions
Please note that selecting a different draw mode the parameters will be reset to default.
The string parameter can include any of the parameters which can be used with the DrawAnnot action, i.e. Color and Alpha.
Example:
procedure TForm1.SetColor1Click(Sender: TObject);
begin
if (pdf<>nil) and ColorDialog1.Execute then
pdf.CommandStrEx(COMPDF_Ann_ModifyAddProps,
'Color=' + ColorToString(ColorDialog1.Color), 4 );
end;
procedure TForm1.SetAlphaClick(Sender: TObject);
begin
if (pdf<>nil) then
pdf.CommandStrEx(COMPDF_Ann_ModifyAddProps,
'Alpha=' + IntToStr((Sender as TMenuItem).Tag ), 4);
end;
In Mode 1 also this parameters can be changed:
Fieldname
Value
FieldType
PopupID
AcroXID
This parameters are used by COMPDF_Ann_AddAnnotation when acro fields are created.
For draw objects and annotations this names can be used
Font
Font-Size
Alpha
Line-Width
Line-Color
This names are only used by draw objects
Brush-Color
Text
Annotations use
Contents
Values
Color
Background-Color
Highlight annotations use
HighlightType
to select the type. "Highlight" or "Square"
and of course the "prp." property names which can be used to create PDF properties which should be written to the PDF file.
The included "PDFEdit.EXE" has a menu item under "Info":
When "Property Peek" has been activated the XML properties of the object under the mouse cursor will be displayed. This makes it easy to check what parameter names can be used or changed for an object.