public static void Run() { try { // ExStart:ExtractAnnotations // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations(); // Create PdfAnnotationEditor PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor(); // Open PDF document annotationEditor.BindPdf(dataDir + "ExtractAnnotations.pdf"); // Extract annotations Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line }; ArrayList annotList = (ArrayList)annotationEditor.ExtractAnnotations(1, 2, annotType); for (int index = 0; index < annotList.Count; index++) { Annotation annotation = (Annotation)annotList[index]; Console.WriteLine(annotation.Contents); } // ExEnd:ExtractAnnotations } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Run() { try { // ExStart:ExtractAnnotations // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations(); // Create PdfAnnotationEditor PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor(); // Open PDF document annotationEditor.BindPdf(dataDir + "ExtractAnnotations.pdf"); // Extract annotations string[] annotType = { AnnotationType.FreeText.ToString(), AnnotationType.Line.ToString() }; ArrayList annotList = (ArrayList)annotationEditor.ExtractAnnotations(1, 2, annotType); for (int index = 0; index < annotList.Count; index++) { Annotation annotation = (Annotation)annotList[index]; Console.WriteLine(annotation.Contents); } // ExEnd:ExtractAnnotations } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Run() { // ExStart:PdfAnnotationEditorFeatures // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); // Create an object of PdfAnnotationEditor class PdfAnnotationEditor editor = new PdfAnnotationEditor(); // Bind input PDF file editor.BindPdf(dataDir + "inFile.pdf"); // Create a new object of type Annotation to modify annotation attributes Aspose.Pdf.Annotations.FreeTextAnnotation annotation = new Aspose.Pdf.Annotations.FreeTextAnnotation( editor.Document.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), new Aspose.Pdf.Annotations.DefaultAppearance("TimesNewRoman", 14, System.Drawing.Color.Orange)); // Set new annotation attributees annotation.Subject = "technical article"; // Modify annotations in the PDF file editor.ModifyAnnotations(1, 5, annotation); // Delete all the annotations of type Stamp editor.DeleteAnnotation("Stamp"); // Extract annotations to an array list // String[] annType = { "Text" }; string[] annotType = { Aspose.Pdf.Annotations.AnnotationType.FreeText.ToString(), Aspose.Pdf.Annotations.AnnotationType.Line.ToString() }; ArrayList list = (ArrayList)editor.ExtractAnnotations(1, 5, annotType); for (int index = 0; index < list.Count; index++) { Aspose.Pdf.Annotations.Annotation list_annotation = (Aspose.Pdf.Annotations.Annotation)list[index]; Console.WriteLine(list_annotation.Contents); } // Import annotations from another PDF file string[] importFrom = new string[1]; importFrom[0] = dataDir + "inFile2.pdf"; editor.ImportAnnotations(importFrom); // Finally save the output PDF file editor.Save(dataDir + "PdfAnnotationEditorFeatures_out.pdf"); // ExEnd:PdfAnnotationEditorFeatures }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create PdfAnnotationEditor PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor(); //open PDF document annotationEditor.BindPdf(dataDir+ "input.pdf"); //extract annotations Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line }; ArrayList annotList = (ArrayList)annotationEditor.ExtractAnnotations(1, 2, annotType); for (int index = 0; index < annotList.Count; index++) { Annotation annotation = (Annotation)annotList[index]; Console.WriteLine(annotation.Contents); } }
public static void Run() { // ExStart:PdfAnnotationEditorFeatures // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); // Create an object of PdfAnnotationEditor class PdfAnnotationEditor editor = new PdfAnnotationEditor(); // Bind input PDF file editor.BindPdf(dataDir + "inFile.pdf"); // Create a new object of type Annotation to modify annotation attributes Aspose.Pdf.Annotations.FreeTextAnnotation annotation = new Aspose.Pdf.Annotations.FreeTextAnnotation( editor.Document.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), new Aspose.Pdf.Annotations.DefaultAppearance("TimesNewRoman", 14, System.Drawing.Color.Orange)); // Set new annotation attributees annotation.Subject = "technical article"; // Modify annotations in the PDF file editor.ModifyAnnotations(1, 5, annotation); // Delete all the annotations of type Stamp editor.DeleteAnnotation("Stamp"); // Extract annotations to an array list // String[] annType = { "Text" }; Enum[] annotType = { Aspose.Pdf.Annotations.AnnotationType.FreeText, Aspose.Pdf.Annotations.AnnotationType.Line }; ArrayList list = (ArrayList)editor.ExtractAnnotations(1, 5, annotType); for (int index = 0; index < list.Count; index++) { Aspose.Pdf.Annotations.Annotation list_annotation = (Aspose.Pdf.Annotations.Annotation)list[index]; Console.WriteLine(list_annotation.Contents); } // Import annotations from another PDF file string[] importFrom = new string[1]; importFrom[0] = dataDir + "inFile2.pdf"; editor.ImportAnnotations(importFrom); // Finally save the output PDF file editor.Save(dataDir + "PdfAnnotationEditorFeatures_out.pdf"); // ExEnd:PdfAnnotationEditorFeatures }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create PdfAnnotationEditor PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor(); //open PDF document annotationEditor.BindPdf(dataDir + "input.pdf"); //extract annotations Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line }; ArrayList annotList = (ArrayList)annotationEditor.ExtractAnnotations(1, 2, annotType); for (int index = 0; index < annotList.Count; index++) { Annotation annotation = (Annotation)annotList[index]; Console.WriteLine(annotation.Contents); } }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations(); //create PdfAnnotationEditor PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor(); //open PDF document annotationEditor.BindPdf(dataDir + "ExtractAnnotations.pdf"); //extract annotations Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line }; ArrayList annotList = (ArrayList)annotationEditor.ExtractAnnotations(1, 2, annotType); for (int index = 0; index < annotList.Count; index++) { Annotation annotation = (Annotation)annotList[index]; Console.WriteLine(annotation.Contents); } }