Action Graph Inspection and GoToE Navigation
THPDFActionBuilder creates PDF 1.6 GoToE actions for destinations inside embedded or related PDF documents, while the loaded-action API reads all 18 standard PDF action subtypes without executing them
GoToE builders
class function GoToEmbeddedNamedDestination(
const RootFileName, DestinationName: AnsiString;
const TargetPath: array of THPDFEmbeddedTarget;
NewWindow: boolean = false): THPDFActionBuilder;
class function GoToEmbeddedPage(
const RootFileName: AnsiString;
TargetPageIndex: Integer;
const TargetPath: array of THPDFEmbeddedTarget;
FitMode: THPDFDestinationFitMode = dfmFit;
Left: Single = 0; Top: Single = 0;
Right: Single = 0; Bottom: Single = 0;
Zoom: Single = 0; NewWindow: boolean = false): THPDFActionBuilder;
Build each target path entry with HPDFEmbeddedParentTarget, HPDFEmbeddedFileTarget, or an HPDFEmbeddedAnnotationTarget overload
A child selected through the EmbeddedFiles name tree writes /R /C plus /N, while an attachment-annotation child writes /R /C plus the required /P and /A pair
Parent entries write only /R /P, nested entries become recursive /T dictionaries, and an empty RootFileName requires a non-empty target path
Independent annotation selectors
The page selector /P and annotation selector /A can independently use an index or a name
| Constructor arguments | Page selector | Annotation selector |
|---|---|---|
HPDFEmbeddedAnnotationTarget(PageIndex, AnnotationIndex) | Integer | Integer |
HPDFEmbeddedAnnotationTarget(PageName, AnnotationName) | PDF byte string | PDF byte string (existing overload) |
HPDFEmbeddedAnnotationTarget(PageIndex, AnnotationName) | Integer | PDF text string |
HPDFEmbeddedAnnotationTarget(PageName, AnnotationIndex) | PDF byte string | Integer |
All indices are zero-based and nonnegative, and name arguments must be nonempty
PageName identifies a destination inside the target document and retains the supplied bytes, including embedded zero and non-ASCII bytes
The new page-index/annotation-name overload uses the existing UTF-8 annotation-text convention and writes valid non-ASCII text as a UTF-16BE PDF string with a byte-order mark
The four original target enum values retain their ordinals, and THPDFEmbeddedTarget retains its field order and layout; rebuild dependent units and generated C++Builder headers for the appended enum values and overloads
Builders own a copy of the target array, and each installation creates distinct action and target dictionaries; a rejected selector does not replace an annotation's existing action
Delphi example
var
Action: THPDFActionBuilder;
Targets: THPDFEmbeddedTargetArray;
begin
SetLength(Targets, 2);
Targets[0] := HPDFEmbeddedFileTarget('chapter.pdf');
Targets[1] := HPDFEmbeddedParentTarget;
Action := THPDFActionBuilder.GoToEmbeddedNamedDestination(
'containers\root.pdf', 'EmbeddedStart', Targets, True);
try
HotPDF.CurrentPage.SetAnnotationAction(Annot, Action);
finally
Action.Free;
end;
end;
Loaded action graph
function GetLoadedActionChain(ActionObject: THPDFObject): THPDFLoadedActionInfoArray;
function GetLoadedOpenActionChain: THPDFLoadedActionInfoArray;
function GetLoadedDocumentActionChain(ActionType: THPDFActionScriptType): THPDFLoadedActionInfoArray;
function GetLoadedPageActionChain(PageIndex: Integer; Trigger: THPDFPageActionTrigger): THPDFLoadedActionInfoArray;
function GetLoadedAnnotationPrimaryActionChain(PageIndex, AnnotationIndex: Integer): THPDFLoadedActionInfoArray;
function GetLoadedAnnotationActionChain(PageIndex, AnnotationIndex: Integer; Trigger: THPDFAnnotationActionTrigger): THPDFLoadedActionInfoArray;
function GetLoadedFormFieldActionChain(FieldIndex: Integer; Trigger: THPDFFormFieldActionTrigger): THPDFLoadedActionInfoArray;
function GetLoadedOutlineActionChain(OutlineIndex: Integer): THPDFLoadedActionInfoArray;
The returned array follows execution order: the parent action appears first, followed by each /Next dictionary or array member in ordered depth-first sequence
THPDFLoadedActionInfo.Kind identifies GoTo, GoToR, GoToE, Launch, Thread, URI, Sound, Movie, Hide, Named, SubmitForm, ResetForm, ImportData, JavaScript, SetOCGState, Rendition, Trans, or GoTo3DView
Core operands are decoded into destination, file, URI, JavaScript, target, operation, flag, volume, optional-boolean, and related-object fields
NewWindow uses obAbsent, obFalse, or obTrue so a missing value remains distinct from an explicit false value
The reader never executes an action and never follows an unbounded graph
Malformed entries, cycles, repeated shared nodes, depth over 64, node count over 4096, and oversized /Next arrays return diagnostic records through Malformed and Issue
Annotation visibility triggers
THPDFAnnotationActionTrigger and THPDFAnnotationJavaScriptTrigger include page-open /PO, page-close /PC, page-visible /PV, and page-invisible /PI entries
These four triggers negotiate PDF 1.5, while the existing mouse and focus action triggers retain their earlier version requirements