Class PdfLoadedAnnotationCollection
The class provides methods and properties to handle the collection of PdfLoadedAnnotation.
Implements
System.Collections.IEnumerable
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.Parsing
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfLoadedAnnotationCollection : PdfAnnotationCollection, IEnumerable, IPdfWrapper
Examples
//Load an existing PDF document.
PdfLoadedDocument document = new PdfLoadedDocument(@"Annotations.pdf");
//Get the annotation collection.
PdfLoadedAnnotationCollection annotationCollection=document.Pages[0].Annotations;
//Get the sound annotation.
PdfLoadedSoundAnnotation soundAnnotation = annotationCollection[5] as PdfLoadedSoundAnnotation;
//Set the sound annotation border.
soundAnnotation.Border.Width = 4;
soundAnnotation.Border.HorizontalRadius = 20;
soundAnnotation.Border.VerticalRadius = 30;
//Set the PDF sound.
PdfSound sound = new PdfSound("Startup.wav");
soundAnnotation.Sound=sound;
//Save the document.
document.Save("SoundAnnotation.pdf");
document.Close(true);
'Load an existing PDF document.
Dim document As New PdfLoadedDocument("Annotations.pdf")
'Gets the annotation collection.
Dim annotationCollection As PdfLoadedAnnotationCollection = document.Pages(0).Annotations
'Get the PDF sound annotation.
Dim soundAnnotation As PdfLoadedSoundAnnotation = dannotationCollection(5)
'Set the sound annotation border.
soundAnnotation.Border.Width = 4
soundAnnotation.Border.HorizontalRadius = 20
soundAnnotation.Border.VerticalRadius = 30
'Set the PDF sound.
Dim sound As PdfSound = New PdfSound("Startup.wav")
soundAnnotation.Sound=sound
'Save the document.
document.Save("SoundAnnotation.pdf")
document.Close(True)
Properties
Flatten
Gets or sets the boolean flag to flatten the annotations.
Declaration
public bool Flatten { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"Annotations.pdf");
//Get the annotation collection
PdfLoadedAnnotationCollection annotationCollection=document.Pages[0].Annotations;
//Set flatten.
annotationCollection.Flatten = true;
//Save the document.
document.Save("output.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("Annotations.pdf")
'Get the annotation collection
Dim annotationCollection As PdfLoadedAnnotationCollection = document.Pages(0).Annotations
'Set flatten.
annotationCollection.Flatten = True
'Save the document.
document.Save("output.pdf")
document.Close(True)
Item[Int32]
Gets the PdfAnnotation at the specified index.
Declaration
public override PdfAnnotation this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type |
---|
PdfAnnotation |
Overrides
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"Annotations.pdf");
//Get the annotation collection.
PdfLoadedAnnotationCollection annotationCollection=document.Pages[0].Annotations;
//Get the PDF sound annotation.
PdfLoadedSoundAnnotation soundAnnotation = annotationCollection[5] as PdfLoadedSoundAnnotation;
//Set the sound annotation border
soundAnnotation.Border.Width = 4;
//Save the document.
document.Save("SoundAnnotation.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("Annotations.pdf")
'Get the annotation from loaded document.
Dim annotationCollection As PdfLoadedAnnotationCollection = document.Pages(0).Annotations
'Get the PDF sound annotation.
Dim soundAnnotation As PdfLoadedSoundAnnotation = dannotationCollection(5)
'Set the sound annotation border.
soundAnnotation.Border.Width = 4
'Save the document.
document.Save("SoundAnnotation.pdf")
document.Close(True)
Item[String]
Gets the PdfAnnotation using specified annotation name.
Declaration
public PdfAnnotation this[string text] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
Property Value
Type |
---|
PdfAnnotation |
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"Annotations.pdf");
//Get the annotation collection.
PdfLoadedAnnotationCollection annotationCollection=document.Pages[0].Annotations;
//Get the pfd sound annotation.
PdfLoadedSoundAnnotation soundAnnotation = annotationCollection["SoundAnnotation"] as PdfLoadedSoundAnnotation;
//Set the sound annotation border
soundAnnotation.Border.Width = 4;
//Save the document.
document.Save("SoundAnnotation.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("Annotations.pdf")
'Get the annotation collection.
Dim annotationCollection As PdfLoadedAnnotationCollection = document.Pages(0).Annotations
'Get the pfd sound annotation.
Dim soundAnnotation As PdfLoadedSoundAnnotation = dannotationCollection("SoundAnnotation")
'Set the sound annotation border
soundAnnotation.Border.Width = 4
'Save the document.
document.Save("SoundAnnotation.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 collection
PdfLoadedAnnotationCollection annotationCollection=document.Pages[0].Annotations;
//Get the PDF sound annotation.
PdfLoadedSoundAnnotation soundAnnotation = annotationCollection[5] as PdfLoadedSoundAnnotation;
'Get the sound PDF loaded 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")
'Get the annotation collection
Dim annotationCollection As PdfLoadedAnnotationCollection = document.Pages(0).Annotations
'Get the PDF sound annotation.
Dim soundAnnotation As PdfLoadedSoundAnnotation = dannotationCollection(5)
'Get the PDF loaded page.
Dim page As PdfLoadedPage=soundAnnotation.Page
'Save the document.
document.Save("SoundAnnotation.pdf")
document.Close(True)
Methods
Add(PdfAnnotation)
Adds annotation to the collection.
Declaration
public override int Add(PdfAnnotation annotation)
Parameters
Type | Name | Description |
---|---|---|
PdfAnnotation | annotation | Annotation to be added to collection. |
Returns
Type | Description |
---|---|
System.Int32 | Position of the annotation in collection. |
Overrides
Examples
//Load an existing document.
PdfLoadedDocument document = new PdfLoadedDocument(@"Annotations.pdf");
//Get the annotation collection
PdfLoadedAnnotationCollection annotationCollection = document.Pages[0].Annotations;
//Create a new rectangle
RectangleF rectangle = new RectangleF(10, 40, 30, 30);
//Create a new Uri Annotation.
PdfUriAnnotation uriAnnotation = new PdfUriAnnotation(rectangle, "http://www.google.com");
//Set Text to uriAnnotation.
uriAnnotation.Text = "Uri Annotation";
annotationCollection.Add(uriAnnotation);
//Save the document.
document.Save("SoundAnnotation.pdf");
document.Close(true);
'Load an existing document.
Dim document As New PdfLoadedDocument("Annotations.pdf")
'Get the annotation collection
Dim annotationCollection As PdfLoadedAnnotationCollection = document.Pages(0).Annotations
'Create a new rectangle
Dim rectangle As RectangleF = New RectangleF(10, 40, 30, 30)
'Create a new Uri Annotation.
Dim uriAnnotation As PdfUriAnnotation = New PdfUriAnnotation(rectangle, "http://www.google.com")
'Set the Text to uriAnnotation.
uriAnnotation.Text = "Uri Annotation"
annotationCollection.Add(uriAnnotation)
'Save the document.
document.Save("SoundAnnotation.pdf")
document.Close(True)
DoAdd(PdfAnnotation)
Adds a annotation to collection.
Declaration
protected override int DoAdd(PdfAnnotation annot)
Parameters
Type | Name | Description |
---|---|---|
PdfAnnotation | annot | The annotation. |
Returns
Type |
---|
System.Int32 |
Overrides
DoClear()
Clears the collection.
Declaration
protected override void DoClear()
Overrides
DoInsert(Int32, PdfAnnotation)
Inserts a annotation into collection.
Declaration
protected override void DoInsert(int index, PdfAnnotation annot)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
PdfAnnotation | annot |
Overrides
DoRemove(PdfAnnotation)
Removes the annotation from collection.
Declaration
protected override void DoRemove(PdfAnnotation annot)
Parameters
Type | Name | Description |
---|---|---|
PdfAnnotation | annot |
Overrides
DoRemoveAt(Int32)
Removes the annotation at the specified position.
Declaration
protected override void DoRemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
Overrides
Implements
System.Collections.IEnumerable