PdfFileLinkAnnotation Class
Represents the annotation link to an external file.
Inheritance
System.Object
PdfFileLinkAnnotation
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfFileLinkAnnotation : PdfActionLinkAnnotation, IPdfWrapper, INotifyPropertyChanged
Remarks
This PdfFileLinkAnnotation class is used to link the external file to PDF document. Please refer the UG docuemntation link https://help.syncfusion.com/file-formats/pdf/working-with-annotations#file-link-annotation for more details.
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)
Constructors
PdfFileLinkAnnotation(RectangleF, String)
Declaration
public PdfFileLinkAnnotation(RectangleF rectangle, string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.RectangleF | rectangle | The bounds of the annotation. |
System.String | fileName | 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.
Declaration
public override PdfAction Action { get; set; }
Property Value
Type | Description |
---|---|
PdfAction | The action to be executed when the annotation is activated. |
Overrides
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
Declaration
public string FileName { get; set; }
Property Value
Type | Description |
---|---|
System.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.
Declaration
protected override void Save()
Overrides
Implements
System.ComponentModel.INotifyPropertyChanged