Class PdfLoadedAnnotationCollection
- Namespace
- Syncfusion.Pdf.Parsing
- Assembly
- Syncfusion.Pdf.Portable.dll
The class provides methods and properties to handle the collection of PdfLoadedAnnotation.
public class PdfLoadedAnnotationCollection : PdfAnnotationCollection, IEnumerable
- Inheritance
-
PdfLoadedAnnotationCollection
- Implements
- Inherited Members
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.
public bool Flatten { get; set; }
Property Value
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)
this[int]
Gets the PdfAnnotation at the specified index.
public override PdfAnnotation this[int index] { get; }
Parameters
index
int
Property Value
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)
this[string]
Gets the PdfAnnotation using specified annotation name.
public PdfAnnotation this[string text] { get; }
Parameters
text
string
Property Value
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.
public PdfLoadedPage Page { get; set; }
Property Value
- 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.
public override int Add(PdfAnnotation annotation)
Parameters
annotation
PdfAnnotationAnnotation to be added to collection.
Returns
- int
Position of the annotation in collection.
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.
protected override int DoAdd(PdfAnnotation annot)
Parameters
annot
PdfAnnotationThe annotation.
Returns
DoClear()
Clears the collection.
protected override void DoClear()
DoInsert(int, PdfAnnotation)
Inserts a annotation into collection.
protected override void DoInsert(int index, PdfAnnotation annot)
Parameters
index
intThe index.
annot
PdfAnnotation
DoRemove(PdfAnnotation)
Removes the annotation from collection.
protected override void DoRemove(PdfAnnotation annot)
Parameters
annot
PdfAnnotation
DoRemoveAt(int)
Removes the annotation at the specified position.
protected override void DoRemoveAt(int index)
Parameters
index
intThe index.