Skip to content

AnnotationNamedDestination interface

Represents a named destination in the document.

Inherited from Annotation

Annotation::Annotation interface

The Annotation interface represents a single annotation on a given page.

To obtain this interface, call the Page.GetFirstAnnotation, Page.GetNextAnnotation, or Page.GetAnnotationCount method.

Annotation::Annotate method

Applies the annotation to the provided canvas. This is the equivalent of calling the Canvas::Annotate method.

Annotation::Appearance property

Contains the appearance streams for the annotation.

Annotation::Border property

Indicates the border style of the annotation.

Annotation::Color property

Indicates the color of the annotation.

Annotation::DateCreated property

Indicates the date the annotation was created.

Annotation::DateModified property

Indicates the date the annotation was last modified.

Annotation::Flags property

Indicates the flags of the annotation.

Annotation::Intent property

String containing a name describing the intent of the markup annotation. Intents allow viewer applications to distinguish between different uses and behaviors of a single markup annotation type. If this entry is not present or its value is the same as the annotation type, the annotation has no explicit intent and should behave in a generic manner in a viewer app.

Annotation::Name property

Indicates the name of the annotation.

Annotation::Opacity property

The constant opacity value to be used in painting the annotation

Annotation::Popup property

Pop-up annotation for entering or editing the text associated with this annotation.

Annotation::Rect property

Indicates the rectangle of the annotation.

Annotation::Replies property

Contains the list of replies to the annotation.

Annotation::Subject property

Text representing a short description of the subject being addressed by the annotation.

Annotation::Text property

String 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.

Annotation::Type property

Indicates the type of the annotation.

Sample code

using var source = api.OpenExtractor(sourceFilename, OpenMode.Paginated);
using var canvas = api.MakeOutputCanvas(destFilename, CanvasType.PDF);

canvas.BlankPage((int)(8.5 * 96), (int)(11 * 96));
canvas.SetBrush(0, 1);
canvas.SetFont("Arial", 11, 0);

// create a simple table of contents
int y = 36;
for (int i = 0; i < source.PageCount; ++i)
{
    var text = $"Page {i + 1}";
    canvas.TextOut(36, y, text);
    canvas.Annotate(new Annotations.Link
    {
        Action = new Annotations.ActionGoTo
        {
            Name = $"sourcePage{i + 1}"
        },
        Rect = new System.Drawing.Rectangle(36, y, canvas.TextWidth(text), lineHeight)
    }); 
    y += (int) (lineHeight * 1.2);
}

// render the actual document and create named destinations
for (var i = 0; i < source.PageCount; ++i)
{
    using (var page = source.GetPage(i))
    {
        canvas.RenderPage(page);
        canvas.Annotate(new Annotations.NamedDestination
        {
            Name = $"sourcePage{i+1}",
            Rect = new System.Drawing.Rectangle(0, 0, page.Width, page.Height),
        });
    }
}

See also