Ejemplo n.º 1
0
        public static PdfAnnotation createMarkup(PdfWriter writer, Rectangle rect, string contents, int type, float[] quadPoints)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);
            PdfName       name  = PdfName.HIGHLIGHT;

            switch (type)
            {
            case MARKUP_UNDERLINE:
                name = PdfName.UNDERLINE;
                break;

            case MARKUP_STRIKEOUT:
                name = PdfName.STRIKEOUT;
                break;
            }
            annot.put(PdfName.SUBTYPE, name);
            annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            PdfArray array = new PdfArray();

            for (int k = 0; k < quadPoints.Length; ++k)
            {
                array.Add(new PdfNumber(quadPoints[k]));
            }
            annot.put(PdfName.QUADPOINTS, array);
            return(annot);
        }
Ejemplo n.º 2
0
        public static PdfAnnotation createStamp(PdfWriter writer, Rectangle rect, string contents, string name)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            annot.put(PdfName.SUBTYPE, PdfName.STAMP);
            annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            annot.put(PdfName.NAME, new PdfName(name));
            return(annot);
        }
Ejemplo n.º 3
0
        public static PdfAnnotation createFreeText(PdfWriter writer, Rectangle rect, string contents, PdfContentByte defaultAppearance)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            annot.put(PdfName.SUBTYPE, PdfName.FREETEXT);
            annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            annot.DefaultAppearancestring = defaultAppearance;
            return(annot);
        }
Ejemplo n.º 4
0
        protected static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            annot.put(PdfName.SUBTYPE, PdfName.LINK);
            if (!highlight.Equals(HIGHLIGHT_INVERT))
            {
                annot.put(PdfName.H, highlight);
            }
            return(annot);
        }
Ejemplo n.º 5
0
        public static PdfAnnotation createPopup(PdfWriter writer, Rectangle rect, string contents, bool open)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            annot.put(PdfName.SUBTYPE, PdfName.POPUP);
            annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            if (open)
            {
                annot.put(PdfName.OPEN, PdfBoolean.PDFTRUE);
            }
            return(annot);
        }
Ejemplo n.º 6
0
        public static PdfAnnotation createLine(PdfWriter writer, Rectangle rect, string contents, float x1, float y1, float x2, float y2)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            annot.put(PdfName.SUBTYPE, PdfName.LINE);
            annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            PdfArray array = new PdfArray(new PdfNumber(x1));

            array.Add(new PdfNumber(y1));
            array.Add(new PdfNumber(x2));
            array.Add(new PdfNumber(y2));
            annot.put(PdfName.L, array);
            return(annot);
        }
Ejemplo n.º 7
0
        public static PdfAnnotation createSquareCirlcle(PdfWriter writer, Rectangle rect, string contents, bool square)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            if (square)
            {
                annot.put(PdfName.SUBTYPE, PdfName.SQUARE);
            }
            else
            {
                annot.put(PdfName.SUBTYPE, PdfName.CIRCLE);
            }
            annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            return(annot);
        }
Ejemplo n.º 8
0
        public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, string namedDestination)
        {
            PdfAnnotation annot = createLink(writer, rect, highlight);

            annot.put(PdfName.DEST, new PdfString(namedDestination));
            return(annot);
        }
Ejemplo n.º 9
0
        public static PdfAnnotation createLink(PdfWriter writer, Rectangle rect, PdfName highlight, int page, PdfDestination dest)
        {
            PdfAnnotation        annot = createLink(writer, rect, highlight);
            PdfIndirectReference piref = writer.getPageReference(page);

            dest.addPage(piref);
            annot.put(PdfName.DEST, dest);
            return(annot);
        }
Ejemplo n.º 10
0
        public static PdfAnnotation createInk(PdfWriter writer, Rectangle rect, string contents, float[][] inkList)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            annot.put(PdfName.SUBTYPE, PdfName.STAMP);
            annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            PdfArray outer = new PdfArray();

            for (int k = 0; k < inkList.Length; ++k)
            {
                PdfArray inner = new PdfArray();
                float[]  deep  = inkList[k];
                for (int j = 0; j < deep.Length; ++j)
                {
                    inner.Add(new PdfNumber(deep[j]));
                }
                outer.Add(inner);
            }
            annot.put(PdfName.INKLIST, outer);
            return(annot);
        }
Ejemplo n.º 11
0
        public static PdfAnnotation createText(PdfWriter writer, Rectangle rect, string title, string contents, bool open, string icon)
        {
            PdfAnnotation annot = new PdfAnnotation(writer, rect);

            annot.put(PdfName.SUBTYPE, PdfName.TEXT);
            if (title != null)
            {
                annot.put(PdfName.T, new PdfString(title, PdfObject.TEXT_UNICODE));
            }
            if (contents != null)
            {
                annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE));
            }
            if (open)
            {
                annot.put(PdfName.OPEN, PdfBoolean.PDFTRUE);
            }
            if (icon != null)
            {
                annot.put(PdfName.NAME, new PdfName(icon));
            }
            return(annot);
        }