コード例 #1
0
 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);
     }
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
 public static void Main()
 {
     // The path to the documents directory.
     string dataDir = Path.GetFullPath("../../../Data/");
     //open document
     PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor();
     annotationEditor.BindPdf(dataDir+ "input.pdf");
     //delete all annoations
     annotationEditor.DeleteAnnotations();
     //save updated PDF
     annotationEditor.Save(dataDir+ "output.pdf");
 }
コード例 #4
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //open document
            PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor();

            annotationEditor.BindPdf(dataDir + "input.pdf");
            //delete all annoations
            annotationEditor.DeleteAnnotations("Text");
            //save updated PDF
            annotationEditor.Save(dataDir + "output.pdf");
        }
コード例 #5
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
            //open document
            PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor();

            annotationEditor.BindPdf(dataDir + "DeleteAllAnnotations.pdf");
            //delete all annoations
            annotationEditor.DeleteAnnotations("Text");
            //save updated PDF
            annotationEditor.Save(dataDir + "DeleteAllAnnotations_out.pdf");
        }
コード例 #6
0
 public static void Run()
 {
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
     //open document
     PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor();
     annotationEditor.BindPdf(dataDir+ "DeleteAllAnnotations.pdf");
     //delete all annoations
     annotationEditor.DeleteAnnotations("Text");
     //save updated PDF
     annotationEditor.Save(dataDir+ "DeleteAllAnnotations_out.pdf");
     
 }
コード例 #7
0
 public static void Run()
 {
     // ExStart:DeleteSpecificAnnotations
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
     // Open document
     PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor();
     annotationEditor.BindPdf(dataDir+ "DeleteAllAnnotations.pdf");
     // Delete specific annoations
     annotationEditor.DeleteAnnotations("Text");
     // Save updated PDF
     annotationEditor.Save(dataDir + "DeleteSpecificAnnotations_out.pdf");
     // ExEnd:DeleteSpecificAnnotations
 }
コード例 #8
0
        public static void Run()
        {
            // ExStart:DeleteSpecificAnnotations
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
            // Open document
            PdfAnnotationEditor annotationEditor = new PdfAnnotationEditor();

            annotationEditor.BindPdf(dataDir + "DeleteAllAnnotations.pdf");
            // Delete specific annoations
            annotationEditor.DeleteAnnotations("Text");
            // Save updated PDF
            annotationEditor.Save(dataDir + "DeleteSpecificAnnotations_out.pdf");
            // ExEnd:DeleteSpecificAnnotations
        }
コード例 #9
0
 public static void Main()
 {
     // The path to the documents directory.
     string dataDir = Path.GetFullPath("../../../Data/");
     //create PdfAnnotationEditor object
     PdfAnnotationEditor AnnotationEditor = new PdfAnnotationEditor();
     //open PDF document
     AnnotationEditor.BindPdf(dataDir+ "input.pdf");
     //import annotations
     FileStream fileStream = new System.IO.FileStream(dataDir+ "annotations.xfdf", System.IO.FileMode.Create);
     Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line };
     AnnotationEditor.ExportAnnotationsXfdf(fileStream, 1, 5, annotType);
     //save output PDF
     AnnotationEditor.Save(dataDir+ "output.pdf");
 }
コード例 #10
0
        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
        }
コード例 #11
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
            //create PdfAnnotationEditor object
            PdfAnnotationEditor AnnotationEditor = new PdfAnnotationEditor();
            //open PDF document
            AnnotationEditor.BindPdf(dataDir+ "ImportAnnotations.pdf");
            //import annotations
            FileStream fileStream = new System.IO.FileStream(dataDir+ "annotations.xfdf", System.IO.FileMode.Open, System.IO.FileAccess.Read);
            Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line };
            AnnotationEditor.ImportAnnotationFromXfdf(fileStream, annotType);
            //save output PDF
            AnnotationEditor.Save(dataDir + "ImportAnnotations_out.pdf");
 
            
        }
コード例 #12
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
            //create PdfAnnotationEditor object
            PdfAnnotationEditor AnnotationEditor = new PdfAnnotationEditor();

            //open PDF document
            AnnotationEditor.BindPdf(dataDir + "ImportAnnotations.pdf");
            //import annotations
            FileStream fileStream = new System.IO.FileStream(dataDir + "annotations.xfdf", System.IO.FileMode.Open, System.IO.FileAccess.Read);

            Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line };
            AnnotationEditor.ImportAnnotationFromXfdf(fileStream, annotType);
            //save output PDF
            AnnotationEditor.Save(dataDir + "ImportAnnotations_out.pdf");
        }
コード例 #13
0
 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);
     }
 }
コード例 #14
0
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");
            //create PdfAnnotationEditor object
            PdfAnnotationEditor AnnotationEditor = new PdfAnnotationEditor();

            //open PDF document
            AnnotationEditor.BindPdf(dataDir + "input.pdf");
            //import annotations
            FileStream fileStream = new System.IO.FileStream(dataDir + "annotations.xfdf", System.IO.FileMode.Create);

            Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line };
            AnnotationEditor.ExportAnnotationsXfdf(fileStream, 1, 5, annotType);
            //save output PDF
            AnnotationEditor.Save(dataDir + "output.pdf");
        }
コード例 #15
0
        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                      
        }
コード例 #16
0
        public static void Run()
        {
            // ExStart:AnnotationsExport
            // 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 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);
            // ExEnd:AnnotationsExport                      
        }
コード例 #17
0
        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);
            }
        }
コード例 #18
0
 public static void Run()
 {
     // ExStart:ExportAnnotations
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
     // Create PdfAnnotationEditor object
     PdfAnnotationEditor AnnotationEditor = new PdfAnnotationEditor();
     // Open PDF document
     AnnotationEditor.BindPdf(dataDir+ "ExportAnnotations.pdf");
     // Export annotations
     FileStream fileStream = new System.IO.FileStream(dataDir + "exportannotations.xfdf", System.IO.FileMode.Create);
     Enum[] annotType = { AnnotationType.FreeText, AnnotationType.Line };
     AnnotationEditor.ExportAnnotationsXfdf(fileStream, 1, 5, annotType);
     // Save output PDF
     AnnotationEditor.Save(dataDir+ "ExportAnnotations_out.pdf");
     fileStream.Flush();
     fileStream.Close();            
     // ExEnd:ExportAnnotations
 }
コード例 #19
0
        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);
            }
        }
コード例 #20
0
        public static void Run()
        {
            // ExStart:AnnotationsExport
            // 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 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
            string[] annoType = { AnnotationType.Text.ToString() };
            // Export annotations of specified type(s) to XFDF file
            editor.ExportAnnotationsXfdf(fileStream, 1, 5, annoType);
            // ExEnd:AnnotationsExport
        }
コード例 #21
0
        public static void Run()
        {
            // ExStart:ExportAnnotations
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
            // Create PdfAnnotationEditor object
            PdfAnnotationEditor AnnotationEditor = new PdfAnnotationEditor();

            // Open PDF document
            AnnotationEditor.BindPdf(dataDir + "ExportAnnotations.pdf");
            // Export annotations
            FileStream fileStream = new System.IO.FileStream(dataDir + "exportannotations.xfdf", System.IO.FileMode.Create);

            string[] annotType = { AnnotationType.FreeText.ToString(), AnnotationType.Line.ToString() };
            AnnotationEditor.ExportAnnotationsXfdf(fileStream, 1, 5, annotType);
            // Save output PDF
            AnnotationEditor.Save(dataDir + "ExportAnnotations_out.pdf");
            fileStream.Flush();
            fileStream.Close();
            // ExEnd:ExportAnnotations
        }
コード例 #22
0
        public static void Run()
        {
            // ExStart:AnnotationsImport
            // 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 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");
            // ExEnd:AnnotationsImport
        }