コード例 #1
0
        public void PutSquigglyAnnotationTest()
        {
            SquigglyAnnotation annotation = new SquigglyAnnotation(Rect: new Rectangle(101, 101, 201, 201))
            {
                Name  = "Test Squiggly Annotation Updated",
                Flags = new List <AnnotationFlags> {
                    AnnotationFlags.Hidden, AnnotationFlags.NoView
                },
                HorizontalAlignment = HorizontalAlignment.Center,
                RichText            = "Rich Text Updated",
                Subject             = "Subj Updated",
                ZIndex     = 1,
                Title      = "Title Updated",
                QuadPoints = new List <Point>
                {
                    new Point(11, 11),
                    new Point(21, 11),
                    new Point(11, 21),
                    new Point(11, 11)
                },
                Modified = "02/02/2018 00:00:00.000 AM"
            };

            var    lineResponse = PdfApi.GetDocumentSquigglyAnnotations(Name, folder: TempFolder);
            string annotationId = lineResponse.Annotations.List[0].Id;

            var response = PdfApi.PutSquigglyAnnotation(Name, annotationId, annotation, folder: TempFolder);

            Assert.That(response.Code, Is.EqualTo(200));
        }
コード例 #2
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);

                float l = Left;
                float t = Top;
                float w = Width;
                float h = Height;
                float a = RotationAngle;

                Rectangle        = null;
                Rectangle.Left   = l;
                Rectangle.Top    = t;
                Rectangle.Width  = w;
                Rectangle.Height = h;
                Rectangle.Angle  = a;

                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);
            TextMarkupAnnotation.CopyTo(Dictionary, res, Page, page);

            SquigglyAnnotation annot = new SquigglyAnnotation(res, owner);

            annot.SetPage(page, true);
            return(annot);
        }
        public void PutSquigglyAnnotationExample()
        {
            //ExStart: PutSquigglyAnnotationExample
            SquigglyAnnotation annotation = new SquigglyAnnotation()
            {
                Name  = "Example Squiggly Annotation Updated",
                Rect  = new Rectangle(101, 101, 201, 201),
                Flags = new List <AnnotationFlags> {
                    AnnotationFlags.Hidden, AnnotationFlags.NoView
                },
                HorizontalAlignment = HorizontalAlignment.Center,
                RichText            = "Rich Text Updated",
                Subject             = "Subj Updated",
                ZIndex     = 1,
                Title      = "Title Updated",
                QuadPoints = new List <Point>
                {
                    new Point(11, 11),
                    new Point(21, 11),
                    new Point(11, 21),
                    new Point(11, 11)
                },
                Modified = "02/02/2018 00:00:00.000 AM"
            };

            var    lineResponse = api.GetDocumentSquigglyAnnotations(Name, folder: FolderName);
            string annotationId = lineResponse.Annotations.List[0].Id;

            var response = api.PutSquigglyAnnotation(Name, annotationId, annotation, folder: FolderName);

            Console.WriteLine(response);
            //ExEnd: PutSquigglyAnnotationExample
        }
コード例 #4
0
        public void TesSquigglyAnnotation()
        {
            Document document = new Document();

            document.Pages.Add(new Page(PaperFormat.A4));
            SquigglyAnnotation annot = new SquigglyAnnotation(100, 50, 75, 50);

            annot.Contents = "PDF squiggly annotation";
            annot.Color    = new ColorRGB(80, 50, 150);

            document.Pages[0].Annotations.Add(annot);
            document.Save(OutputFolder + @"\TestSquigglyAnnotation.pdf");
            document.Dispose();

            //Process.Start("TestSquigglyAnnotation.pdf");
        }
コード例 #5
0
        private void parseAnnotations()
        {
            for (int i = 0; i < _array.Count; ++i)
            {
                PDFDictionary annotDict = _array[i] as PDFDictionary;
                if (annotDict != null)
                {
                    if (annotDict["IRT"] == null)
                    {
                        PDFName subtype = annotDict["Subtype"] as PDFName;
                        if (subtype != null)
                        {
                            Annotation annot = null;
                            switch (subtype.GetValue())
                            {
                            case "Text":
                                annot = new TextAnnotation(annotDict, _owner);
                                break;

                            case "Link":
                                annot = new LinkAnnotation(annotDict, _owner);
                                break;

                            case "FreeText":
                                annot = new FreeTextAnnotation(annotDict, _owner);
                                break;

                            case "Line":
                                annot = new LineAnnotation(annotDict, _owner);
                                break;

                            case "Square":
                                annot = new SquareAnnotation(annotDict, _owner);
                                break;

                            case "Circle":
                                annot = new CircleAnnotation(annotDict, _owner);
                                break;

                            case "Polygon":
                                annot = new PolygonAnnotation(annotDict, _owner);
                                break;

                            case "PolyLine":
                                annot = new PolylineAnnotation(annotDict, _owner);
                                break;

                            case "Highlight":
                                annot = new HighlightAnnotation(annotDict, _owner);
                                break;

                            case "Underline":
                                annot = new UnderlineAnnotation(annotDict, _owner);
                                break;

                            case "Squiggly":
                                annot = new SquigglyAnnotation(annotDict, _owner);
                                break;

                            case "StrikeOut":
                                annot = new StrikeOutAnnotation(annotDict, _owner);
                                break;

                            case "Stamp":
                                annot = new RubberStampAnnotation(annotDict, _owner);
                                break;

                            case "Caret":
                                annot = new CaretAnnotation(annotDict, _owner);
                                break;

                            case "Ink":
                                annot = new InkAnnotation(annotDict, _owner);
                                break;

                            case "FileAttachment":
                                annot = new FileAttachmentAnnotation(annotDict, _owner);
                                break;

                            case "Sound":
                                annot = new SoundAnnotation(annotDict, _owner);
                                break;

                            case "Movie":
                                annot = new MovieAnnotation(annotDict, _owner);
                                break;

                            case "Screen":
                                annot = new ScreenAnnotation(annotDict, _owner);
                                break;

                            case "3D":
                                annot = new ThreeDAnnotation(annotDict, _owner);
                                break;

                            case "Widget":
                                PDFName ft = annotDict["FT"] as PDFName;
                                if (ft == null)
                                {
                                    PDFDictionary parent = annotDict["Parent"] as PDFDictionary;
                                    if (parent != null)
                                    {
                                        ft = parent["FT"] as PDFName;
                                    }
                                }

                                if (ft != null)
                                {
                                    switch (ft.GetValue())
                                    {
                                    case "Tx":
                                        annot = new EditBox(annotDict, _owner);
                                        break;

                                    case "Ch":
                                        uint flag = getFlag(annotDict);
                                        if ((flag >> 17) % 2 != 0)
                                        {
                                            annot = new ComboBox(annotDict, _owner);
                                        }
                                        else
                                        {
                                            annot = new ListBox(annotDict, _owner);
                                        }
                                        break;

                                    case "Btn":
                                        flag = getFlag(annotDict);
                                        if ((flag >> 16) % 2 != 0)
                                        {
                                            annot = new PushButton(annotDict, _owner);
                                        }
                                        else if ((flag >> 15) % 2 != 0)
                                        {
                                            annot = new RadioButton(annotDict, _owner);
                                        }
                                        else
                                        {
                                            annot = new CheckBox(annotDict, _owner);
                                        }
                                        break;
                                    }
                                }
                                break;
                            }

                            if (annot != null)
                            {
                                annot.SetPage(_page, false);
                                _annotations.Add(annot);
                            }
                        }
                    }
                }
            }
        }