Created
November 13, 2020 00:52
-
-
Save farhan-raza/9cb0e775efaf1a49854fb74112bd2d42 to your computer and use it in GitHub Desktop.
Import or Export Annotations from PDF and XFDF using C# VB.NET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an object of PdfAnnotationEditor class | |
PdfAnnotationEditor editor = new PdfAnnotationEditor(); | |
// Bind input PDF file | |
editor.BindPdf(dataDir + "inFile.pdf"); | |
// Create a file stream for output XFDF file to export annotations | |
FileStream fileStream = new FileStream(dataDir + "exportannotations.xfdf", FileMode.Create, FileAccess.Write); | |
// Create an enumeration of all the annotation types which you want to export | |
Enum[] annoType = { AnnotationType.Text }; | |
// Export annotations of specified type(s) to XFDF file | |
editor.ExportAnnotationsXfdf(fileStream, 1, 5, annoType); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an object of PdfAnnotationEditor class | |
PdfAnnotationEditor editor = new PdfAnnotationEditor(); | |
// Bind input PDF file | |
editor.BindPdf(dataDir + "inFile.pdf"); | |
// Create a file stream for input XFDF file to import annotations | |
FileStream fileStream = new FileStream(dataDir + "exportannotations.xfdf", FileMode.Open, FileAccess.Read); | |
// Create an enumeration of all the annotation types which you want to import | |
Enum[] annType = { AnnotationType.Text }; | |
// Import annotations of specified type(s) from XFDF file | |
editor.ImportAnnotationFromXfdf(fileStream, annType); | |
// Save output pdf file | |
editor.Save(dataDir + "ImportAnnotations_out.pdf"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment