THotPDF.SetLoadedFreeTextPlainText Method
Explicitly converts a supported loaded FreeText annotation to left-aligned plain text and rebuilds its normal appearance
Declaration
procedure SetLoadedFreeTextPlainText(PageIndex, AnnotationIndex: Integer;
const AText: AnsiString; FontSize: Single = 12);
Unit: HPDFDoc · Available since Version 2.753.0
Parameters
PageIndex: zero-based index of the loaded pageAnnotationIndex: zero-based annotation index on that pageAText: printable ASCII characters, with CR, LF or CR/LF for explicit line breaks; tabs, other control characters and non-ASCII text are rejectedFontSize: finite size in PDF points, greater than zero and at most 10,000, defaulting to 12
Appearance conversion
The method uses black Helvetica text and a black rectangular border, retains a supported device-colour background and solid or dashed border geometry and clips text to a two-point inset within the annotation rectangle
Lines advance by 1.2 times the font size; there is no automatic wrapping or shrink-to-fit, so text outside the inset is clipped
The conversion replaces /AP, updates /Contents and /DA, sets /Q to zero and removes /RC, /DS and /AS; the old rich text, font selection, text colour, alignment and appearance states are intentionally replaced
Annotation, appearance and page changes are registered for incremental saving and the page render cache is invalidated; rewrite saving also preserves the new appearance
Supported input and errors
The annotation must exist and have subtype FreeText, with a finite rectangle wider and taller than four points
Callouts, rectangle differences or insets, border effects, a rotation entry, non-FreeText intent, non-opaque annotations, rounded borders and border styles other than solid or dashed are rejected with EArgumentException
DeviceGray, DeviceRGB and DeviceCMYK background components must sit between zero and one; border widths and dash patterns must be valid, finite and nonnegative; a nonempty all-zero dash pattern is rejected
Unsupported input is validated before replacing the annotation or its appearance
Example
For a loaded document whose first annotation on page zero is a supported FreeText annotation
PDF.SetLoadedFreeTextPlainText(0, 0,
'Updated review note'#13#10'Second line', 12);
Related APIs
SetLoadedAnnotationContents only changes the stored contents string and preserves an existing appearance
SetLoadedFreeTextRichText · AddLoadedFreeTextAnnotation · THotPDF · Home