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

DynaPDF.WebLink

Inserts a web link onto the current open page.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 4.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.WebLink"; PDF; PosX; PosY; Width; Height; URL )   More

Parameters

Parameter Description Example
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
URL URL defined as null-terminated 7 bit ASCII string. "http://www.mbsplugins.de"

Result

Returns new handle or error.

Description

Inserts a web link onto the current open page.
The parameter URL holds the URL defined as 7 bit ASCII string. A uniform resource locator (URL) is a string that resolves to a resource on the internet - typically a file that is the destination of a hypertext link, although it can also resolve to a query or other entity. A web link opens the standard browser to view the resource by default. The full version of Adobes Acrobat enables you also to embed a reverenced html resource in your 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.

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.

Please use DynaPDF.WriteText if you first want to add text to the page before you make it a clickable link.

Use DynaPDF.WebLink for web links, DynaPDF.FileLink for file links, DynaPDF.PageLink or DynaPDF.PageLinkEx for page links and DynaPDF.FindText can help to find the location where to place the link.

See also WebLink function in DynaPDF manual.

Examples

Add a link to MBS Blog:

MBS( "DynaPDF.WebLink"; $PDF; 100; 100; 100; 20; "https://www.mbsplugins.de/filemaker" )

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)]

Setup drawing for links:

Set Variable [ $r ; Value: MBS("DynaPDF.SetLineWidth"; $pdf; 1) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetLinkHighlightMode"; $pdf; "invert") ]

Add a link to an area of a PDF:

Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Set some flags for import
Set Variable [ $r ; Value: MBS("DynaPDF.SetImportFlags"; $pdf; "ImportAll ImportAsPage") ]
#
# Add first page
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; PDF::Input PDF) ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf; 1) ]
#
# setup drawing for links
Set Variable [ $r ; Value: MBS("DynaPDF.SetLineWidth"; $pdf; 1) ]
Set Variable [ $r ; Value: MBS("DynaPDF.SetLinkHighlightMode"; $pdf; "invert") ]
#
# edit page
Set Variable [ $r ; Value: MBS("DynaPDF.EditPage"; $pdf; 1) ]
# now add a link to an area there
Set Variable [ $r ; Value: MBS( "DynaPDF.WebLink"; $pdf; 100; 100; 200; 200; "https://www.monkeybreadsoftware.com/filemaker/" ) ]
#
Set Variable [ $r ; Value: MBS("DynaPDF.EndPage"; $pdf) ]
#
Go to Layout [ “PDF” (PDF) ; Animation: None ]
# save PDF
Set Variable [ $PDFData ; Value: MBS("DynaPDF.Save"; $pdf; GetAsText(PDF::Input PDF)) ]
#
# Free all data
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]
#
# Put in Container
Set Field [ PDF::Output PDF ; $PDFData ]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 30th January 2024


DynaPDF.WatermarkAnnot - DynaPDF.WriteDemoText