private void HideAllPages(PdfDocument doc)
        {
            foreach (PdfPage page in doc.Pages)
            {
                var gfx = XGraphics.FromPdfPage(page);
                SquareCircleAnnotation BigWhiteBox = new SquareCircleAnnotation(true);
                BigWhiteBox.Opacity = 1;
                //BigWhiteBox.Elements["/BS"] = new PdfBorderStyle(1, PdfSharp.Pdf.BorderStyle.Solid);
                // Convert rectangle from world space to page space. This is necessary because the annotation is
                // placed relative to the bottom left corner of the page with units measured in point.

                BigWhiteBox.Rectangle = new PdfRectangle(gfx.Transformer.WorldToDefaultPage(new XRect(new PdfSharp.Drawing.XPoint(0, 0), gfx.PageSize)));
                BigWhiteBox.Color     = XColor.FromKnownColor(XKnownColor.White);
                BigWhiteBox.FillColor = XColor.FromKnownColor(XKnownColor.White);

                BigWhiteBox.Flags    = PdfAnnotationFlags.Print | PdfAnnotationFlags.Locked | PdfAnnotationFlags.ReadOnly;
                BigWhiteBox.Contents = "ScreenProtector";
                page.Annotations.Add(BigWhiteBox);
            }
        }
Exemple #2
0
        internal override Annotation Clone(IDocumentEssential owner, Page page)
        {
            if (Page == null)
            {
                ApplyOwner(owner);
                SetPage(page, true);
                return(this);
            }

            PDFDictionary res = AnnotationBase.Copy(Dictionary);

            MarkupAnnotationBase.CopyTo(Dictionary, res);
            SquareCircleAnnotation.CopyTo(Dictionary, res);

            SquareAnnotation annot = new SquareAnnotation(res, owner);

            annot.SetPage(Page, false);
            annot.SetPage(page, true);
            return(annot);
        }