private static void EditAnnotations(PdfDocumentProcessor processor)
        {
            //Retrieve annotations made by the specified author:
            var textMarkups =
                processor.GetMarkupAnnotationData(1).Where(annotation => annotation.Author.Contains("Cardle Anita L"));

            foreach (PdfMarkupAnnotationData markup in textMarkups)
            {
                //Get all text markup annotations from the retrieved list:
                PdfTextMarkupAnnotationData pdfTextMarkup = markup.AsTextMarkupAnnotation();
                if (pdfTextMarkup != null)
                {
                    //Change the annotation's markup type:
                    pdfTextMarkup.MarkupType = PdfTextMarkupAnnotationType.Squiggly;
                }
            }

            var annotations = processor.GetMarkupAnnotationData(1);

            foreach (PdfMarkupAnnotationData annotation in annotations)
            {
                //Get all text annotations:
                PdfTextAnnotationData textAnnotation = annotation.AsTextAnnotation();
                if (textAnnotation != null)
                {
                    //Change the annotation icon:
                    textAnnotation.IconName = PdfTextAnnotationIconName.Note;
                }
            }
            annotations[0].AddReview("Borman Aaron Lewis", PdfAnnotationReviewStatus.Completed);
        }
        static void Main(string[] args)
        {
            // Create a PDF Document Processor.
            using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
                // Load a document.
                processor.LoadDocument("..\\..\\Document.pdf");

                // Add a text markup annotation to the first page for a text corresponding to the specified page area.
                PdfTextMarkupAnnotationData annot = processor.AddTextMarkupAnnotation(1, new PdfRectangle(90, 100, 240, 230),
                                                                                      PdfTextMarkupAnnotationType.Highlight);
                if (annot != null)
                {
                    // Specify the annotation properties.
                    annot.Author   = "Bill Smith";
                    annot.Contents = "Note";
                    annot.Color    = new PdfRGBColor(0.8, 0.2, 0.1);

                    // Save the result document.
                    processor.SaveDocument("..\\..\\Result.pdf");
                }
                else
                {
                    Console.WriteLine("The annotation cannot be added to a page. Make sure, a specified page area corresponds to a text on the page.");
                }
            }
        }
        private static void CreateAnnotations(PdfDocumentProcessor processor)
        {
            //Add a text markup annotation at the first page:
            PdfDocumentPosition startPosition = new PdfDocumentPosition(1, new PdfPoint(113, 224));
            PdfDocumentPosition endPosition   = new PdfDocumentPosition(1, new PdfPoint(272, 207));

            PdfTextMarkupAnnotationData textMarkupAnnotation = processor.AddTextMarkupAnnotation(startPosition, endPosition,
                                                                                                 PdfTextMarkupAnnotationType.Highlight);

            if (textMarkupAnnotation != null)
            {
                //Specify the annotation properties:
                textMarkupAnnotation.Author   = "Bill Smith";
                textMarkupAnnotation.Subject  = "Important!";
                textMarkupAnnotation.Contents = "Please, fact-check this diagram";
                textMarkupAnnotation.Color    = new PdfRGBColor(0.10, 0.85, 1.00);
                AddAnnotationComments(textMarkupAnnotation);
            }

            //Add a sticky note at the first page:
            PdfTextAnnotationData textAnnotation = processor.AddTextAnnotation(1, new PdfPoint(64, 65));

            //Specify the annotation parameters:
            textAnnotation.Author   = "Nancy Davolio";
            textAnnotation.Color    = new PdfRGBColor(0.8, 0.2, 0.1);
            textAnnotation.Contents = "Please proofread this document";
            textAnnotation.IconName = PdfTextAnnotationIconName.Check;
            AddAnnotationComments(textAnnotation);
        }
Exemplo n.º 4
0
 //This method uses annotations to highlight text
 public static void HighlightResult(PdfDocumentProcessor processor, PdfTextSearchResults result)
 {
     for (int i = 0; i < result.Rectangles.Count; i++)
     {
         PdfTextMarkupAnnotationData annotation =
             processor.AddTextMarkupAnnotation(result.PageNumber, result.Rectangles[i], PdfTextMarkupAnnotationType.Highlight);
         if (annotation != null)
         {
             annotation.Color = new PdfRGBColor(0.2, 0.6, 0);
         }
     }
 }