SetLinkAddress

Description

Links the current object to a URL.

Applies to

PDFText object

PDFImage object

PDFMultilineText object

PDFTextBlock object

Syntax

long SetLinkAddress(string linkAddress)

Argument

Description

linkAddress

The URL that the current object links to. It may be a URL to a local file, FTP address, HTTP/HTTPS address, or an email address.

The supported URL protocols include:

  • For accessing a local file: file://

  • For accessing an FTP address: ftp://

  • For accessing an HTTP address: http://

  • For accessing an HTTPS address: https://

  • For accessing an email address: mailto://


Return value

Long. Returns 1 if it succeeds, or -1 if an error occurs. For more errors, see the Error Codes.

Usage

Call the function to link the current object with the URL to a local file, FTP address, HTTP/HTTPS address, or an email address. When the object is clicked in the PDF document, the URL will be opened.

Examples

The following example links the PDFImage object in the document to the URL address https://translate.google.com.

PDFdocument lpdf_doc
PDFpage lpdf_page
pdfimage lpdf_image

lpdf_doc = create PDFdocument
lpdf_page = create PDFpage
lpdf_image = create pdfimage

lpdf_image.filename = "D:\image1\1.jpg"
lpdf_image.setsize( 100, 100)
// setlinkaddress
lpdf_image.setlinkaddress( "https://translate.google.com")
//getlinkaddress
lpdf_image.getlinkaddress( )
lpdf_page.addcontent( lpdf_image)
lpdf_doc.addpage( lpdf_page)
lpdf_doc.save( "D:\save\pdfimage_setlink.pdf")

PDFText, PDFImage, PDFTextBlock objects:

Clone

GetLinkAddress

LinkToObject

PDFMultilineText objects:

Clone

GetLinkAddress

GetOverflowPageText

IsOverflowPage

LinkToObject