LinkToObject

Description

Links the current object to an object that already exists in the PDF document.

Applies to

PDFText object

PDFImage object

PDFMultilineText object

PDFTextBlock object

Syntax

long LinkToObject(PDFModel object)

Argument

Description

object

The object that the current object links to. The object type can only be one of the following: PDFText, PDFImage, PDFMultilinkText, PDFTextBlock, PDFPage.


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 specified object.

Examples

The following example links the PDFText object (with the content "jump to me") to the current PDFText object (with the content "I am PDFtext text).

PDFdocument lpdf_doc
PDFpage lpdf_page
PDFtext lpdf_text,lpdf_textlink

lpdf_doc = create PDFdocument
lpdf_page = create PDFpage
lpdf_text = create PDFtext
lpdf_textlink = create PDFtext

lpdf_text.backcolor.rgb = rgb(255,0,0)
lpdf_text.textcolor.rgb = rgb(0,255,0)
lpdf_text.font.fontsize = 38
lpdf_text.content = "I am PDFtext text"
lpdf_textlink.content = "jump to me"
//Support PDFtext, PDFmultilinetext, PDFimage, PDFtextblock, and PDFPage
lpdf_text.linktoobject( lpdf_textlink)

lpdf_page.addcontent( lpdf_text)
lpdf_page.addcontent( lpdf_textlink)

lpdf_doc.addpage( lpdf_page)
lpdf_doc.save( "D:\textlink.pdf")

See also

PDFText, PDFImage, PDFTextBlock objects:

Clone

GetLinkAddress

SetLinkAddress

PDFMultilineText objects:

Clone

GetLinkAddress

GetOverflowPageText

IsOverflowPage

SetLinkAddress