55//Register your Syncfusion License Key
66Syncfusion . Licensing . SyncfusionLicenseProvider . RegisterLicense ( "Your License Key" ) ;
77
8- //Export specific types of annotations and a specific collection of annotations from a PDF document to XFDF format
8+ //Export specific types of annotations from a PDF document to XFDF format
99ExportSpecificTypesOfAnnotations ( ) ;
10+ //Export a specific collection of annotations from a PDF document to XFDF format
1011ExportSpecificCollectionOfAnnotations ( ) ;
1112
1213static void ExportSpecificTypesOfAnnotations ( )
@@ -30,30 +31,30 @@ static void ExportSpecificTypesOfAnnotations()
3031
3132static void ExportSpecificCollectionOfAnnotations ( )
3233{
33- //Load the PDF document
34- using ( PdfLoadedDocument document = new PdfLoadedDocument ( "../../../../data/annotations.pdf" ) )
35- {
36- //Create annotation export collection
37- PdfExportAnnotationCollection exportAnnotationCollection = new PdfExportAnnotationCollection ( ) ;
34+ //Load the PDF document
35+ using ( PdfLoadedDocument document = new PdfLoadedDocument ( "../../../../data/annotations.pdf" ) )
36+ {
37+ //Create annotation export collection
38+ PdfExportAnnotationCollection exportAnnotationCollection = new PdfExportAnnotationCollection ( ) ;
3839
39- //Iterate through the pages in the document
40- foreach ( PdfLoadedPage page in document . Pages )
40+ //Iterate through the pages in the document
41+ foreach ( PdfLoadedPage page in document . Pages )
42+ {
43+ //Iterate through the annotations in the page
44+ foreach ( PdfLoadedAnnotation annotation in page . Annotations )
4145 {
42- //Iterate through the annotations in the page
43- foreach ( PdfLoadedAnnotation annotation in page . Annotations )
46+ //Check the author of the annotation
47+ if ( annotation . Author == "John Milton" )
4448 {
45- //Check if the annotation is of type Highlight
46- if ( annotation . Type == PdfLoadedAnnotationType . Highlight )
47- {
48- //Add the annotation to the export collection
49- exportAnnotationCollection . Add ( annotation ) ;
50- }
49+ //Add the annotation to the export collection
50+ exportAnnotationCollection . Add ( annotation ) ;
5151 }
5252 }
53-
54- //Export the specified annotations to XFDF format
55- document . ExportAnnotations ( "export-specific-collection.xfdf" , AnnotationDataFormat . XFdf , exportAnnotationCollection ) ;
5653 }
54+
55+ //Export the specified annotations to XFDF format
56+ document . ExportAnnotations ( "export-specific-collection.xfdf" , AnnotationDataFormat . XFdf , exportAnnotationCollection ) ;
57+ }
5758}
5859
5960
0 commit comments