modern-pdf-lib / PdfLinkAnnotation
Class: PdfLinkAnnotation
Defined in: src/annotation/types/linkAnnotation.ts:38
A link annotation (subtype /Link).
Provides navigation to a destination within the document or to an external URI.
Extends
Constructors
Constructor
new PdfLinkAnnotation(
dict):PdfLinkAnnotation
Defined in: src/annotation/types/linkAnnotation.ts:39
Parameters
dict
Returns
PdfLinkAnnotation
Overrides
Properties
annotationType
readonlyannotationType:AnnotationType
Defined in: src/annotation/pdfAnnotation.ts:227
The annotation subtype.
Inherited from
dict
protecteddict:PdfDict
Defined in: src/annotation/pdfAnnotation.ts:230
The underlying annotation dictionary.
Inherited from
Methods
generateAppearance()
generateAppearance():
PdfStream|undefined
Defined in: src/annotation/pdfAnnotation.ts:440
Generate an appearance stream for this annotation.
The base implementation returns undefined. Subclasses override to produce proper visual appearance.
Returns
PdfStream | undefined
A PdfStream for the /AP /N entry, or undefined.
Inherited from
PdfAnnotation.generateAppearance
getAuthor()
getAuthor():
string|undefined
Defined in: src/annotation/pdfAnnotation.ts:293
Get the author (PDF /T entry).
Returns
string | undefined
Inherited from
getColor()
getColor(): {
b:number;g:number;r:number; } |undefined
Defined in: src/annotation/pdfAnnotation.ts:311
Get the annotation colour.
Returns
{ b: number; g: number; r: number; } | undefined
Inherited from
getContents()
getContents():
string|undefined
Defined in: src/annotation/pdfAnnotation.ts:275
Get the text contents (tooltip / popup text).
Returns
string | undefined
Inherited from
getDestination()
getDestination():
string| [number,string,...number[]] |undefined
Defined in: src/annotation/types/linkAnnotation.ts:90
Get the destination (named dest string or explicit dest array).
Returns:
- A string for named destinations.
- An array
[pageIndex, fitMode, ...params]for explicit destinations. undefinedif no destination is set.
Returns
string | [number, string, ...number[]] | undefined
getHighlightMode()
getHighlightMode():
LinkHighlightMode
Defined in: src/annotation/types/linkAnnotation.ts:159
Get the highlight mode. Defaults to 'Invert'.
Returns
getOpacity()
getOpacity():
number
Defined in: src/annotation/pdfAnnotation.ts:333
Get the annotation opacity (0-1). Defaults to 1.
Returns
number
Inherited from
getRect()
getRect(): [
number,number,number,number]
Defined in: src/annotation/pdfAnnotation.ts:251
Get the annotation rectangle [x1, y1, x2, y2].
Returns
[number, number, number, number]
Inherited from
getType()
getType():
AnnotationType
Defined in: src/annotation/pdfAnnotation.ts:242
Get the annotation subtype.
Returns
Inherited from
getUrl()
getUrl():
string|undefined
Defined in: src/annotation/types/linkAnnotation.ts:135
Get the URL if this is a URI link.
Returns
string | undefined
isHidden()
isHidden():
boolean
Defined in: src/annotation/pdfAnnotation.ts:381
Whether the annotation is hidden.
Returns
boolean
Inherited from
isLocked()
isLocked():
boolean
Defined in: src/annotation/pdfAnnotation.ts:401
Whether the annotation is locked (cannot be moved/resized).
Returns
boolean
Inherited from
isPrintable()
isPrintable():
boolean
Defined in: src/annotation/pdfAnnotation.ts:391
Whether the annotation should be printed.
Returns
boolean
Inherited from
setAuthor()
setAuthor(
author):void
Defined in: src/annotation/pdfAnnotation.ts:302
Set the author.
Parameters
author
string
Returns
void
Inherited from
setColor()
setColor(
color):void
Defined in: src/annotation/pdfAnnotation.ts:324
Set the annotation colour.
Parameters
color
b
number
g
number
r
number
Returns
void
Inherited from
setContents()
setContents(
contents):void
Defined in: src/annotation/pdfAnnotation.ts:284
Set the text contents.
Parameters
contents
string
Returns
void
Inherited from
setDestination()
setDestination(
pageIndex,fit?):void
Defined in: src/annotation/types/linkAnnotation.ts:122
Set an explicit destination (page index + fit mode).
Parameters
pageIndex
number
Zero-based page index.
fit?
string
Fit mode (defaults to 'Fit').
Returns
void
setHidden()
setHidden(
hidden):void
Defined in: src/annotation/pdfAnnotation.ts:386
Set the hidden flag.
Parameters
hidden
boolean
Returns
void
Inherited from
setHighlightMode()
setHighlightMode(
mode):void
Defined in: src/annotation/types/linkAnnotation.ts:179
Set the highlight mode.
Parameters
mode
Returns
void
setLocked()
setLocked(
locked):void
Defined in: src/annotation/pdfAnnotation.ts:406
Set the locked flag.
Parameters
locked
boolean
Returns
void
Inherited from
setOpacity()
setOpacity(
opacity):void
Defined in: src/annotation/pdfAnnotation.ts:342
Set the annotation opacity.
Parameters
opacity
number
Returns
void
Inherited from
setPrintable()
setPrintable(
printable):void
Defined in: src/annotation/pdfAnnotation.ts:396
Set the print flag.
Parameters
printable
boolean
Returns
void
Inherited from
setRect()
setRect(
rect):void
Defined in: src/annotation/pdfAnnotation.ts:266
Set the annotation rectangle.
Parameters
rect
[number, number, number, number]
Returns
void
Inherited from
setUrl()
setUrl(
url):void
Defined in: src/annotation/types/linkAnnotation.ts:147
Set the URL (creates a /URI action).
Parameters
url
string
Returns
void
toDict()
toDict(
registry):PdfDict
Defined in: src/annotation/pdfAnnotation.ts:420
Convert this annotation to a PdfDict suitable for embedding in a PDF.
Parameters
registry
The object registry (used to register sub-objects).
Returns
The annotation dictionary.
Inherited from
create()
staticcreate(options):PdfLinkAnnotation
Defined in: src/annotation/types/linkAnnotation.ts:46
Create a new link annotation.
Parameters
options
AnnotationOptions & object
Returns
PdfLinkAnnotation
fromDict()
staticfromDict(dict,resolver?):PdfLinkAnnotation
Defined in: src/annotation/types/linkAnnotation.ts:71
Create from an existing dictionary.
Parameters
dict
resolver?
(ref) => PdfObject | undefined
Returns
PdfLinkAnnotation