VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Pdf.Tree.Annotations Namespace / PdfLinkAnnotation Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
PdfLinkAnnotation Class
In This Topic
Represents a PDF annotation that displays a link.
Object Model
PdfDestinationBase PdfAction PdfFileReferenceSpecificationList PdfAnnotationAppearanceGenerator PdfOptionalContentGroup PdfPage PdfAnnotationBorderStyle AffineMatrix PdfAnnotationAppearances PdfAnnotationAdditionalActions PdfDocument PdfIndirectReference PdfBasicObject PdfLinkAnnotation
Syntax
'Declaration

Public NotInheritable Class PdfLinkAnnotation
   Inherits PdfAnnotation

public sealed class PdfLinkAnnotation : PdfAnnotation

Example

Here is an example that shows how to create a PDF link annotation:


''' <summary>
''' Creates the PDF documenet with link annotation.
''' </summary>
''' <param name="outputPdfFilename">The output PDF filename.</param>
Public Shared Sub CreatePdfLinkAnnotation(outputPdfFilename As String)
    Using document As New Vintasoft.Imaging.Pdf.PdfDocument(outputPdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14)
        Dim page As Vintasoft.Imaging.Pdf.Tree.PdfPage

        ' Add new page
        page = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4)
        page.Annotations = New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationList(document)
        Dim annotationRectangle As System.Drawing.RectangleF = page.MediaBox
        annotationRectangle.Inflate(-200, -300)

        ' Link annotation
        Dim link As New Vintasoft.Imaging.Pdf.Tree.Annotations.PdfLinkAnnotation(page)
        link.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle, 30, 30)
        link.BorderStyleType = Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationBorderStyleType.Solid
        link.BorderWidth = 2
        link.Color = System.Drawing.Color.Red
        link.HighlightingMode = Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationHighlightingMode.Invert
        link.ActivateAction = New Vintasoft.Imaging.Pdf.Tree.PdfUriAction(document, "http://www.vintasoft.com")
        page.Annotations.Add(link)

        document.SaveChanges()
    End Using
End Sub


/// <summary>
/// Creates the PDF documenet with link annotation.
/// </summary>
/// <param name="outputPdfFilename">The output PDF filename.</param>
public static void CreatePdfLinkAnnotation(string outputPdfFilename)
{
    using (Vintasoft.Imaging.Pdf.PdfDocument document = new Vintasoft.Imaging.Pdf.PdfDocument(
        outputPdfFilename, Vintasoft.Imaging.Pdf.PdfFormat.Pdf_14))
    {
        Vintasoft.Imaging.Pdf.Tree.PdfPage page;

        // Add new page
        page = document.Pages.Add(Vintasoft.Imaging.PaperSizeKind.A4);
        page.Annotations = new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationList(document);
        System.Drawing.RectangleF annotationRectangle = page.MediaBox;
        annotationRectangle.Inflate(-200, -300);

        // Link annotation
        Vintasoft.Imaging.Pdf.Tree.Annotations.PdfLinkAnnotation link = 
            new Vintasoft.Imaging.Pdf.Tree.Annotations.PdfLinkAnnotation(page);
        link.Rectangle = System.Drawing.RectangleF.Inflate(annotationRectangle, 30, 30);
        link.BorderStyleType = Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationBorderStyleType.Solid;
        link.BorderWidth = 2;
        link.Color = System.Drawing.Color.Red;
        link.HighlightingMode = 
            Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotationHighlightingMode.Invert;
        link.ActivateAction = 
            new Vintasoft.Imaging.Pdf.Tree.PdfUriAction(document, "http://www.vintasoft.com");
        page.Annotations.Add(link);

        document.SaveChanges();
    }
}

Inheritance Hierarchy

System.Object
   Vintasoft.Imaging.Pdf.Tree.PdfTreeNodeBase
      Vintasoft.Imaging.Pdf.Tree.Annotations.PdfAnnotation
         Vintasoft.Imaging.Pdf.Tree.Annotations.PdfLinkAnnotation

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also