Class PdfLoadedAnnotation
The class provides methods and properties to handle the loaded annotations from the existing PDF document.
Implements
System.ComponentModel.INotifyPropertyChanged
Inherited Members
Namespace: Syncfusion.Pdf.Interactive
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public abstract class PdfLoadedAnnotation : PdfAnnotation, IPdfWrapper, INotifyPropertyChanged
Remarks
Please refer UG documentation link for PdfSoundAnnotation from this link https://help.syncfusion.com/file-formats/pdf/working-with-annotations#sound-annotation
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"..\..\Annotations.pdf");
//Get the annotation from loaded document.
PdfLoadedSoundAnnotation soundAnnotation = document.Pages[1].Annotations[5] as PdfLoadedSoundAnnotation;
//Get the page.
PdfLoadedPage page =soundAnnotation.Page;
//Save the document.
document.Save("SoundAnnotation.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("..\..\Annotations.pdf")
'Gets the annotation from loaded document.
Dim soundAnnotation As PdfLoadedSoundAnnotation = document.Pages(1).Annotations(5) as PdfLoadedSoundAnnotation
'Gets the page.
Dim page As PdfLoadedPage=soundAnnotation.Page
'Save the document.
document.Save("SoundAnnotation.pdf")
document.Close(True)
Fields
ObjectID
Represents the Form field identifier
Declaration
public int ObjectID
Field Value
| Type |
|---|
| System.Int32 |
Properties
CreationDate
Gets the creation date.
Declaration
public DateTime CreationDate { get; }
Property Value
| Type | Description |
|---|---|
| System.DateTime | The creation date. |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"..\..\Annotations.pdf");
//Gets the annotation from loaded document.
PdfLoadedAnnotation loadedAnnotation = document.Pages[0].Annotations[0] as PdfLoadedAnnotation;
//Gets the creation date.
DateTime creationDate = loadedAnnotation.CreationDate;
//Save the document.
document.Save("output.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("..\..\Annotations.pdf")
'Gets the annotation from loaded document.
Dim loadedAnnotation As PdfLoadedAnnotation = TryCast(document.Pages(0).Annotations(0), PdfLoadedAnnotation)
'Gets the creation date.
DateTime creationDate = loadedAnnotation.CreationDate;
'Save the document.
document.Save("output.pdf")
document.Close(True)
Page
Gets and sets the PdfLoadedPage where the annotation is present.
Declaration
public PdfLoadedPage Page { get; set; }
Property Value
| Type | Description |
|---|---|
| PdfLoadedPage | The PdfLoadedPage of the existing PDF document |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"..\..\Annotations.pdf");
//Get the annotation from loaded document.
PdfLoadedSoundAnnotation soundAnnotation = document.Pages[1].Annotations[5] as PdfLoadedSoundAnnotation;
//Get the page.
PdfLoadedPage page =soundAnnotation.Page;
//Save the document.
document.Save("SoundAnnotation.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("..\..\Annotations.pdf")
'Gets the annotation from loaded document.
Dim soundAnnotation As PdfLoadedSoundAnnotation = document.Pages(1).Annotations(5) as PdfLoadedSoundAnnotation
'Gets the page.
Dim page As PdfLoadedPage=soundAnnotation.Page
'Save the document.
document.Save("SoundAnnotation.pdf")
document.Close(True)
Type
Gets the annotation type.
Declaration
public PdfLoadedAnnotationType Type { get; }
Property Value
| Type | Description |
|---|---|
| PdfLoadedAnnotationType | The annotation type. |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"..\..\Annotations.pdf");
//Gets the annotation from loaded document.
PdfLoadedAnnotation loadedAnnotation = document.Pages[0].Annotations[0] as PdfLoadedAnnotation;
//Gets the annotation type.
PdfLoadedAnnotationType annotationType = loadedAnnotation.Type;
//Save the document.
document.Save("output.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("..\..\Annotations.pdf")
'Gets the annotation from loaded document.
Dim loadedAnnotation As PdfLoadedAnnotation = TryCast(document.Pages(0).Annotations(0), PdfLoadedAnnotation)
'Gets the annotation type.
PdfLoadedAnnotationType annotationType = loadedAnnotation.Type
'Save the document.
document.Save("output.pdf")
document.Close(True)
Methods
GetValues(String)
Gets the values associated with the specified key.
Declaration
public List<string> GetValues(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name value. |
Returns
| Type |
|---|
| System.Collections.Generic.List<System.String> |
SetText(String)
Sets the name of the annotation
Declaration
public void SetText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"..\..\Annotations.pdf");
//Gets the annotation from loaded document.
PdfLoadedSoundAnnotation soundAnnotation = document.Pages[1].Annotations[5] as PdfLoadedSoundAnnotation;
//Sets the annotation text.
soundAnnotation.SetText("Sound Annotation");
//Save the document.
document.Save("SoundAnnotation.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("..\..\Annotations.pdf")
'Gets the annotation from loaded document.
Dim soundAnnotation As PdfLoadedSoundAnnotation = document.Pages(1).Annotations(5) as PdfLoadedSoundAnnotation
'Sets the annotation text.
soundAnnotation.SetText("Sound Annotation")
'Save the document.
document.Save("SoundAnnotation.pdf")
document.Close(True)
SetValues(String, String)
Set the values associated with the specified key.
Declaration
public void SetValues(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | The key value. |
| System.String | value | The value for set. |
Examples
PdfLoadedDocument ldoc = new PdfLoadedDocument("WF_48044_Annotation.pdf");
PdfLoadedPage lpage = ldoc.Pages[0] as PdfLoadedPage;
PdfLoadedAnnotationCollection annots = lpage.Annotations;
PdfLoadedCircleAnnotation Icircle = annots[64] as PdfLoadedCircleAnnotation;
//Get the author
string author = Icircle.Author;
PdfLoadedPopupAnnotationCollection collection = Icircle.ReviewHistory;
PdfLoadedPopupAnnotationCollection collectionComments = Icircle.Comments;
PdfLoadedPopupAnnotation annotation = collection[1] as PdfLoadedPopupAnnotation;
//Set Unknown state and model
annotation.SetValues("State", "StateModel");
annotation.SetValues("StateModel", "CustomState");
ldoc.Save("result.pdf");
Dim ldoc As PdfLoadedDocument = New PdfLoadedDocument("WF_48044_Annotation.pdf")
Dim lpage As PdfLoadedPage = CType(ldoc.Pages(0), PdfLoadedPage)
Dim annots As PdfLoadedAnnotationCollection = lpage.Annotations
Dim Icircle As PdfLoadedCircleAnnotation = CType(annots(64), PdfLoadedCircleAnnotation)
Dim author As String = Icircle.Author
Dim collection As PdfLoadedPopupAnnotationCollection = Icircle.ReviewHistory
Dim collectionComments As PdfLoadedPopupAnnotationCollection = Icircle.Comments
Dim annotation As PdfLoadedPopupAnnotation = CType(collection(1), PdfLoadedPopupAnnotation)
'Set Unknown state and model
annotation.SetValues("State", "StateModel")
annotation.SetValues("StateModel", "CustomState")
ldoc.Save("result.pdf")
TryGetValue(String, out Object)
Declaration
public bool TryGetValue(string key, out object value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | |
| System.Object | value |
Returns
| Type |
|---|
| System.Boolean |
Implements
System.ComponentModel.INotifyPropertyChanged