Пример #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
         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:UpdateAnnotations
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();

            // Open document
            Aspose.Pdf.Facades.PdfAnnotationEditor annotationEditor = new Aspose.Pdf.Facades.PdfAnnotationEditor();
            annotationEditor.BindPdf(dataDir + "input.pdf");

            // Create annotation
            FreeTextAnnotation annotation = new FreeTextAnnotation(annotationEditor.Document.Pages[1], new Aspose.Pdf.Rectangle(200, 400, 400, 600), new DefaultAppearance("TimesNewRoman", 14, System.Drawing.Color.Orange));

            annotation.Modified = DateTime.Now;
            annotation.Contents = "Contents...";
            annotation.Subject  = "Subject";
            annotation.Color    = Color.Green;

            // Modify annotation
            annotationEditor.ModifyAnnotations(1, 1, annotation);

            // Save updated PDF file
            annotationEditor.Save("output_out.pdf");
            // ExEnd:UpdateAnnotations
        }
        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");
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();

            // instantiate PdfContentEditor object
            PdfContentEditor editor = new PdfContentEditor();

            // bind input PDF file
            editor.BindPdf(dataDir + "CreateFileAnnotation.pdf");
            // the last argumnet is for transparency of icon
            editor.CreateFileAttachment(new System.Drawing.Rectangle(50, 50, 10, 10), "here", "simple.doc", 1, "Paperclip", 0.005);
            // save the updated PDF file
            editor.Save(dataDir + "PdfWith_Transparent_Annotation.pdf");
        }
Пример #5
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
        }
Пример #6
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
            //open document
            PdfContentEditor contentEditor = new PdfContentEditor();

            contentEditor.BindPdf(dataDir + "AddFreeTextAnnotation.pdf");
            //crate rectangle
            System.Drawing.Rectangle rect = new System.Drawing.Rectangle(50, 50, 100, 100);
            //create annotation
            contentEditor.CreateFreeText(rect, "Sample content", 1);
            //save updated PDF file
            contentEditor.Save(dataDir + "AddFreeTextAnnotation_out.pdf");
        }
        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");
        }
Пример #8
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);
            }
        }
Пример #9
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
        }
 public static void Run()
 {
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Annotations();
 }