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

DynaPDF.PageLinkEx

Adds a page link to the current open page.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 7.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.PageLinkEx"; PDF; PosX; PosY; Width; Height; DestinationType; DestPage { ; a; b; c; d } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
PosX X-Coordinate of bounding rectangle 100
PosY Y-Coordinate of bounding rectangle 100
Width Width of bounding rectangle 100
Height Height of bounding rectangle 20
DestinationType The destination type.
DestPage The destination page number. 5
a First parameter for destination type. Optional
b Second parameter for destination type. Optional
c Third parameter for destination type. Optional
d Forth parameter for destination type. Optional

Result

Returns OK or error.

Description

Adds a page link to the current open page.
The parameter DestPage specifies the destination page which should be opened (the page number). The function does not check whether the destination page exists; it can be created later. If the destination page is not created before the document is closed, it will be set to the first page of the document.

If the coordinate system is bottom-up the point PosX, PosY defines the lower left corner of the bounding rectangle. If the coordinate system is top-down it defines the upper left corner.

The border of the link annotation is drawn by using the current line width, stroke color and line dash pattern. If the link should appear without a border set the line width to zero beforehand (with DynaPDF.SetLineWidth).

When clicking on a link annotation the rectangle is highlighted, that is a simple visual effect. Several highlight modes are supported, see DynaPDF.SetLinkHighlightMode for further information.
The destination created by this annotation allows jumping to a specific position in a document instead of simply opening the page such as DynaPDF.PageLink does.

Destination typeDescription
XYZoomDisplay the page designated by page with the coordinates (left top) positioned at the top-left corner of the window and the contents of the page magnified by the factor zoom. A zero value for any of the parameters left top or zoom specifies that the current value of that parameter is to be retained unchanged.
FitDisplay the page designated by page with its contents magnified just enough to fit the entire page within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the page within the window in the other dimension. This destination type has no parameters.
FitHTopDisplay the page designated by page with the vertical coordinate top positioned at the top edge of the window and the contents of the page magnified just enough to fit the entire width of the page within the window.
FitVLeftDisplay the page designated by page with the horizontal coordinate left positioned at the left edge of the window and the contents of the page magnified just enough to fit the entire height of the page within the window.
FitRectDisplay the page designated by page with its contents magnified just enough to fit the rectangle specified by the coordinates left bottom right and top entirely within the window both horizontally and vertically. If the required horizontal and vertical magnification factors are different, use the smaller of the two, centering the rectangle within the window in the other dimension.

The destination types FitB, FitBHTop and FitBVLeft use the media box of the page to fit the page into the window. All other destination types use the crop box if any.
The destination types are the same as for a go-to actions and the function creates in fact a go-to action which is executed by the link annotation. However, the action is stored in a more compact format and cannot be shared with other objects.
If a destination should be used with multiple objects such as bookmarks, create a go-to action instead and add it to a normal page link (see DynaPDF.PageLink). The same action can then be added to other objects.

If the function succeeds the return value is the annotation handle, a value greater or equal zero. If the function fails the return value is an error message.

See also PageLinkEx function in DynaPDF manual.

Examples

Add various links to a page:

# import page
Set Variable [$r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Add Page Numbers::Input)]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; 1)]

# edit first page
Set Variable [$r; Value:MBS("DynaPDF.EditPage"; $pdf; 1)]
Set Variable [$r; Value:MBS( "DynaPDF.SetFont"; $pdf; "Helvetica"; 0; 20)]
#Add web link
Set Variable [$r; Value:MBS( "DynaPDF.WriteFTextEx"; $PDF; 100; 100; 150; 20; "left"; "Go to MBS Blog" )]
Set Variable [$r; Value:MBS( "DynaPDF.WebLink"; $PDF; 100; 80; 150; 20; "https://www.mbsplugins.de/filemaker" )]
#Add page link
Set Variable [$r; Value:MBS( "DynaPDF.WriteFTextEx"; $PDF; 100; 150; 150; 20; "left"; "Jump to page 3" )]
Set Variable [$r; Value:MBS( "DynaPDF.PageLink"; $PDF; 100; 130; 150; 20; 3)]
#Add page link with more options
Set Variable [$r; Value:MBS( "DynaPDF.WriteFTextEx"; $PDF; 100; 200; 200; 20; "left"; "Jump to Letter D Zoomed" )]
Set Variable [$r; Value:MBS( "DynaPDF.PageLinkEx"; $PDF; 100; 180; 200; 20; "FitRect"; 4; 60; 590; 135; 160)]
# Close page
Set Variable [$r; Value:MBS("DynaPDF.EndPage"; $pdf)]

See also

Release notes

Blog Entries

This function checks for a license.

Created 18th December 2016, last changed 25th January 2024


DynaPDF.PageLink - DynaPDF.PageStatistics