PDFsharp-net6

PdfLinkAnnotation

Namespace: PdfSharp.Pdf.Annotations

Represents a link annotation.

public sealed class PdfLinkAnnotation : PdfAnnotation, System.ICloneable, System.Collections.Generic.IEnumerable`1[[System.Collections.Generic.KeyValuePair`2[[System.String, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[PdfSharp.Pdf.PdfItem, PdfSharp, Version=0.1.3.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Collections.IEnumerable

Inheritance ObjectPdfItemPdfObjectPdfDictionaryPdfAnnotationPdfLinkAnnotation
Implements ICloneable, IEnumerable<KeyValuePair<String, PdfItem>>, IEnumerable

Properties

Border

Gets or sets the border-properties of this Annotation

public PdfAnnotationBorder Border { get; set; }

Property Value

PdfAnnotationBorder

Flags

Gets or sets the annotation flags of this instance.

public PdfAnnotationFlags Flags { get; set; }

Property Value

PdfAnnotationFlags

Parent

Gets or sets the PdfAnnotations object that this annotation belongs to.

public PdfAnnotations Parent { get; set; }

Property Value

PdfAnnotations

Rectangle

Gets or sets the annotation rectangle, defining the location of the annotation on the page in default user space units.

public PdfRectangle Rectangle { get; set; }

Property Value

PdfRectangle

Page

Gets or sets the page for this Annotation

public PdfPage Page { get; set; }

Property Value

PdfPage

Title

Gets or sets the text label to be displayed in the title bar of the annotation’s pop-up window when open and active. By convention, this entry identifies the user who added the annotation.

public string Title { get; set; }

Property Value

String

Subject

Gets or sets text representing a short description of the subject being addressed by the annotation.

public string Subject { get; set; }

Property Value

String

Contents

Gets or sets the text to be displayed for the annotation or, if this type of annotation does not display text, an alternate description of the annotation’s contents in human-readable form.

public string Contents { get; set; }

Property Value

String

Color

Gets or sets the color representing the components of the annotation. If the color has an alpha value other than 1, it is ignored. Use property Opacity to get or set the opacity of an annotation.

public XColor Color { get; set; }

Property Value

XColor

Opacity

Gets or sets the constant opacity value to be used in painting the annotation. This value applies to all visible elements of the annotation in its closed state (including its background and border) but not to the popup window that appears when the annotation is opened.

public double Opacity { get; set; }

Property Value

Double

Elements

Gets the dictionary containing the elements of this dictionary.

public DictionaryElements Elements { get; }

Property Value

DictionaryElements

Stream

Gets or sets the PDF stream belonging to this dictionary. Returns null if the dictionary has no stream. To create the stream, call the CreateStream function.

public PdfStream Stream { get; set; }

Property Value

PdfStream

Owner

Gets the PdfDocument this object belongs to.

public PdfDocument Owner { get; }

Property Value

PdfDocument

IsIndirect

Indicates whether the object is an indirect object.

public bool IsIndirect { get; }

Property Value

Boolean

Internals

Gets the PdfInternals object of this document, that grants access to some internal structures which are not part of the public interface of PdfDocument.

public PdfObjectInternals Internals { get; }

Property Value

PdfObjectInternals

Reference

Gets the indirect reference of this object. If the value is null, this object is a direct object.

public PdfReference Reference { get; internal set; }

Property Value

PdfReference

ReferenceNotNull

Gets the indirect reference of this object. Throws if it is null.

public PdfReference ReferenceNotNull { get; }

Property Value

PdfReference

Exceptions

InvalidOperationException
The indirect reference must be not null here.

Constructors

PdfLinkAnnotation()

Initializes a new instance of the PdfLinkAnnotation class.

public PdfLinkAnnotation()

PdfLinkAnnotation(PdfDocument)

Initializes a new instance of the PdfLinkAnnotation class.

public PdfLinkAnnotation(PdfDocument document)

Parameters

document PdfDocument

Methods

CreateDocumentLink(PdfRectangle, Int32)

Creates a link within the current document.

public static PdfLinkAnnotation CreateDocumentLink(PdfRectangle rect, int destinationPage)

Parameters

rect PdfRectangle
The link area in default page coordinates.

destinationPage Int32
The one-based destination page number.

Returns

PdfLinkAnnotation

CreateDocumentLink(PdfRectangle, String)

Creates a link within the current document using a named destination.

public static PdfLinkAnnotation CreateDocumentLink(PdfRectangle rect, string destinationName)

Parameters

rect PdfRectangle
The link area in default page coordinates.

destinationName String
The named destination’s name.

Returns

PdfLinkAnnotation

CreateDocumentLink(PdfRectangle, String, String, Nullable<Boolean>)

Creates a link to an external PDF document using a named destination.

public static PdfLinkAnnotation CreateDocumentLink(PdfRectangle rect, string documentPath, string destinationName, Nullable<bool> newWindow)

Parameters

rect PdfRectangle
The link area in default page coordinates.

documentPath String
The path to the target document.

destinationName String
The named destination’s name in the target document.

newWindow Nullable<Boolean>
True, if the destination document shall be opened in a new window. If not set, the viewer application should behave in accordance with the current user preference.

Returns

PdfLinkAnnotation

CreateEmbeddedDocumentLink(PdfRectangle, String, Nullable<Boolean>)

Creates a link to an embedded document.

public static PdfLinkAnnotation CreateEmbeddedDocumentLink(PdfRectangle rect, string destinationPath, Nullable<bool> newWindow)

Parameters

rect PdfRectangle
The link area in default page coordinates.

destinationPath String
The path to the named destination through the embedded documents. The path is separated by ‘' and the last segment is the name of the named destination. The other segments describe the route from the current (root or embedded) document to the embedded document holding the destination. “..” references to the parent, other strings refer to a child with this name in the EmbeddedFiles name dictionary.

newWindow Nullable<Boolean>
True, if the destination document shall be opened in a new window. If not set, the viewer application should behave in accordance with the current user preference.

Returns

PdfLinkAnnotation

CreateEmbeddedDocumentLink(PdfRectangle, String, String, Nullable<Boolean>)

Creates a link to an embedded document in another document.

public static PdfLinkAnnotation CreateEmbeddedDocumentLink(PdfRectangle rect, string documentPath, string destinationPath, Nullable<bool> newWindow)

Parameters

rect PdfRectangle
The link area in default page coordinates.

documentPath String
The path to the target document.

destinationPath String
The path to the named destination through the embedded documents in the target document. The path is separated by ‘' and the last segment is the name of the named destination. The other segments describe the route from the root document to the embedded document. Each segment name refers to a child with this name in the EmbeddedFiles name dictionary.

newWindow Nullable<Boolean>
True, if the destination document shall be opened in a new window. If not set, the viewer application should behave in accordance with the current user preference.

Returns

PdfLinkAnnotation

CreateWebLink(PdfRectangle, String)

Creates a link to the web.

public static PdfLinkAnnotation CreateWebLink(PdfRectangle rect, string url)

Parameters

rect PdfRectangle

url String

Returns

PdfLinkAnnotation

CreateFileLink(PdfRectangle, String)

Creates a link to a file.

public static PdfLinkAnnotation CreateFileLink(PdfRectangle rect, string fileName)

Parameters

rect PdfRectangle

fileName String

Returns

PdfLinkAnnotation

WriteObject(PdfWriter)

internal void WriteObject(PdfWriter writer)

Parameters

writer PdfWriter