Table of Contents

Class PdfFileLinkAnnotation

Namespace
Syncfusion.Pdf.Interactive
Assembly
Syncfusion.Pdf.Portable.dll

Represents the annotation link to an external file.

public class PdfFileLinkAnnotation : PdfActionLinkAnnotation, INotifyPropertyChanged
Inheritance
PdfFileLinkAnnotation
Implements
Inherited Members

Examples

//Create a PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new PDF file link annotation.
PdfFileLinkAnnotation fileLinkAnnotation = new PdfFileLinkAnnotation(rectangle, @"Input.png");
//Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As New RectangleF(10, 40, 30, 30)
'Create a new PDF file link annotation.
Dim fileLinkAnnotation As New PdfFileLinkAnnotation(rectangle, "Input.png")
'Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)

Remarks

This PdfFileLinkAnnotation class is used to link the external file to PDF document. Please refer the UG docuemntation link for more details.

Constructors

PdfFileLinkAnnotation(RectangleF, string)

public PdfFileLinkAnnotation(RectangleF rectangle, string fileName)

Parameters

rectangle RectangleF

The bounds of the annotation.

fileName string

A string value specifying the full path to the file to be embedded.

Examples

//Create a PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new pdf file link annotation.
PdfFileLinkAnnotation fileLinkAnnotation = new PdfFileLinkAnnotation(rectangle, @"Input.png");
//Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a PDF document.
Dim document As New PdfDocument()
'Create a new page.
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As New RectangleF(10, 40, 30, 30)
'Create a new pdf file link annotation.
Dim fileLinkAnnotation As New PdfFileLinkAnnotation(rectangle, "Input.png")
'Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

Properties

Action

Gets or sets the action.

public override PdfAction Action { get; set; }

Property Value

PdfAction

The action to be executed when the annotation is activated.

Examples

//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new file link annotation.
PdfFileLinkAnnotation fileLinkAnnotation = new PdfFileLinkAnnotation(rectangle, "input.png");
//Set an action to file link annotation.
PdfJavaScriptAction javaAction = new PdfJavaScriptAction("app.alert(\"You are looking at Java script action of PDF \")");
fileLinkAnnotation.Action = javaAction;
//Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As New RectangleF(10, 40, 30, 30)
'Create a new file link annotation.
Dim fileLinkAnnotation As New PdfFileLinkAnnotation(rectangle, "input.png")
'Set an action to file link annotation.
Dim javaAction As New PdfJavaScriptAction("app.alert(""You are looking at Java script action of PDF "")")
fileLinkAnnotation.Action = javaAction
'Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also

FileName

public string FileName { get; set; }

Property Value

string

A string value specifying the full path to the file to be embedded.

Examples

//Create a PDF document.
PdfDocument document = new PdfDocument();
//Create a new page.
PdfPage page = document.Pages.Add();
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new PDF file link annotation.
PdfFileLinkAnnotation fileLinkAnnotation = new PdfFileLinkAnnotation(rectangle, @"Input.png");
//Get the file name.
string fileName = fileLinkAnnotation.FileName;
//Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation);
//Save the document to disk.
document.Save("Output.pdf");
//close the document
document.Close(true);
'Create a new PDF document.
Dim document As PdfDocument = New PdfDocument()
'Creates a new page and adds it as the last page of the document
Dim page As PdfPage = document.Pages.Add()
'Create a new rectangle
Dim rectangle As RectangleF = New RectangleF(10, 40, 30, 30)
'Create a new PDF file link annotation.
Dim fileLinkAnnotation As PdfFileLinkAnnotation = New PdfFileLinkAnnotation(rectangle, "Input.png")
'Gets the file name.
Dim fileName As String=fileLinkAnnotation.FileName
'Add this annotation to a new page.
page.Annotations.Add(fileLinkAnnotation)
'Save the document to disk.
document.Save("Output.pdf")
 'close the document
document.Close(true);
See Also

Methods

Save()

Saves annotation object.

protected override void Save()
See Also

See Also