Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.CreateGoToEAction

Creates an embedded GoTo action.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 14.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.CreateGoToEAction"; Location; Source; SrcPage; Target; DestName; Destpage; NewWindow )   More

Parameters

Parameter Description Example
Location Specifies where the embedded file can be found. "Child"
Source Required for external files.
SrcPage Source page, if the file is located in an annotation.
Target The target file that should be opened.
DestName A named destination to be opened.
Destpage Only used if DestName is empty.
NewWindow Open the file in a new window? 0

Result

Returns number or error.

Description

Creates an embedded GoTo action.
This action type opens an embedded PDF file that is located in the current, parent, or in an external PDF file.
Embedded files can be attached directly, e.g. with DynaPDF.AttachFile, or embedded in file attachment annotations with DynaPDF.FileAttachAnnot.
The parameter Location specifies where the embedded file can be found. File attachment annotations are stored in pages and not globally like ordinary file attachments. Therefore, the source page in which the annotation can be found must be known if the target file is stored in a file attachment annotation (parameter SrcPage). The first page number is denoted by 1.
The parameter Source specifies the source file if the embedded file is located in an external PDF file. This parameter is only used if Location is set to "External" or "ExternalAnnot". It can be set to "" in all other cases.
The parameter Target is required; it specifies either the name of the embedded PDF file or the name of the annotation in which the file is stored. The name of a file attachment annotation must be set with DynaPDF.SetAnnotString. The names of all annotations in a page must be unique. The function does not check whether the annotation or embedded file exists. Therefore, the target file can be embedded before or after the action was created.
The name of an embedded file is the file name if it was attached with DynaPDF.AttachFile or DynaPDF.AttachFileContainer. The function extracts the file name automatically if a path was passed to the function.
It is not allowed to use different string formats in DynaPDF.AttachFile or DynaPDF.SetAnnotString and in the corresponding CreateGoToEAction call. The same restriction applies to named destinations.
The destination page that should be opened can be either specified directly with the parameter DestPage or with a Named Destination (see DynaPDF.CreateNamedDest for further information). Named destinations take precedence.
A path to an external PDF file should be defined as relative path. Actions must be added to a PDF object with DynaPDF.AddActionToObj.

ChildThe file is embedded in the current file
ChildAnnotThe file is embedded in a file attachment annotation
ExternalThe file is an embedded file in an external file
ExternalAnnotThe file is embedded in a file attachment annotation
ParentThe file is located in the parent document
ParentAnnotThe file is located in a file attachment annotation

See also CreateGoToEAction function in DynaPDF manual.

Examples

Create a button to open first embedded PDF file:

# we can add a button to open first attachment
Set Variable [ $r ; Value: MBS( "DynaPDF.EditPage"; $PDF; 1) ]
Set Variable [ $FirstFilename ; Value: MBS( "DynaPDF.GetEmbeddedFile"; $PDF; 0; "name") ]
# we create an action to open an embedded file by name
Set Variable [ $Action ; Value: MBS( "DynaPDF.CreateGoToEAction"; $pdf; "Child"; ""; 0; $FirstFilename; ""; 1; 1 ) ]
# we create a button to open that embedded file
Set Variable [ $button ; Value: MBS( "DynaPDF.CreateButton"; $pdf; "OpenAttachment"; "Open First Attachment"; -1; 100; 100; 100; 20 ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.AddActionToObj"; $pdf; "Field"; "OnMouseUp"; $Action; $Button ) ]
Set Variable [ $r ; Value: MBS( "DynaPDF.EndPage"; $PDF) ]

See also

Release notes

  • Version 14.1
    • Added DynaPDF.CreateGoToEAction function.

Blog Entries

This function checks for a license.

Created 17th January 2024, last changed 22nd January 2024


DynaPDF.CreateGoToActionEx - DynaPDF.CreateGoToRAction

💬 Ask a question or report a problem