Package com.lowagie.text

Examples of com.lowagie.text.Annotation


                }
                case Element.ANNOTATION: {
                    if (line == null) {
                        carriageReturn();
                    }
                    Annotation annot = (Annotation) element;
                    Rectangle rect = new Rectangle(0, 0);
                    if (line != null)
                      rect = new Rectangle(annot.llx(indentRight() - line.widthLeft()), annot.lly(indentTop() - currentHeight), annot.urx(indentRight() - line.widthLeft() + 20), annot.ury(indentTop() - currentHeight - 20));
                    PdfAnnotation an = PdfAnnotationsImp.convertAnnotation(writer, annot, rect);
                    annotationsImp.addPlainAnnotation(an);
                    pageEmpty = false;
                    break;
                }
View Full Code Here


                rectangle(image);
                restoreState();
            }
            if (image.getLayer() != null)
                endLayer();
            Annotation annot = image.getAnnotation();
            if (annot == null)
                return;
            float[] r = new float[unitRect.length];
            for (int k = 0; k < unitRect.length; k += 2) {
                r[k] = a * unitRect[k] + c * unitRect[k + 1] + e;
                r[k + 1] = b * unitRect[k] + d * unitRect[k + 1] + f;
            }
            float llx = r[0];
            float lly = r[1];
            float urx = llx;
            float ury = lly;
            for (int k = 2; k < r.length; k += 2) {
                llx = Math.min(llx, r[k]);
                lly = Math.min(lly, r[k + 1]);
                urx = Math.max(urx, r[k]);
                ury = Math.max(ury, r[k + 1]);
            }
            annot = new Annotation(annot);
            annot.setDimensions(llx, lly, urx, ury);
            PdfAnnotation an = PdfAnnotationsImp.convertAnnotation(writer, annot, new Rectangle(llx, lly, urx, ury));
            if (an == null)
                return;
            addAnnotation(an);
        }
View Full Code Here

            }
        }

        // annotations
        if (ElementTags.ANNOTATION.equals(name)) {
            Annotation annotation = ElementFactory.getAnnotation(attributes);
            TextElementArray current;
            try {
                try {
                    current = (TextElementArray) stack.pop();
                    try {
View Full Code Here

            Stack newStack = new Stack();
            while (!(current instanceof Chapter
                    || current instanceof Section || current instanceof LwgCell)) {
                newStack.push(current);
                if (current instanceof Anchor) {
                    img.setAnnotation(new Annotation(0, 0, 0,
                            0, ((Anchor) current).getReference()));
                }
                current = stack.pop();
            }
            ((TextElementArray) current).add(img);
View Full Code Here

                writeEnd(HtmlTags.TABLE);
                return;
            }
            case LwgElement.ANNOTATION:
            {
                Annotation annotation = (Annotation) element;
                writeComment(annotation.title() + ": " + annotation.content());
                return;
            }
            case LwgElement.IMGRAW:
            case LwgElement.JPEG:
            case LwgElement.JPEG2000:
View Full Code Here

            a.setReference("http://www.uni-klu.ac.at");
            doc.add(a);

            LwgImage img = LwgImage.getInstance("pngnow.png");
            doc.add(new Chunk(img, 0, 0));
            doc.add(new Annotation("Mark", "This works!"));

            Chunk c = new Chunk("");
            c.setNewPage();
            doc.add(c);
View Full Code Here

      document2.open();
      // step 4:
      document1.add(new Paragraph("Each square on this page represents an annotation."));
      // document1
            PdfContentByte cb1 = writer1.getDirectContent();
            Annotation a1 = new Annotation(
                "authors", "Maybe it's because I wanted to be an author myself that I wrote iText.",
          250f, 700f, 350f, 800f);
            document1.add(a1);
            Annotation a2 = new Annotation(250f, 550f, 350f, 650f,
                new URL("http://www.lowagie.com/iText/"));
            document1.add(a2);
            Annotation a3 = new Annotation(250f, 400f, 350f, 500f,
                "http://www.lowagie.com/iText");
            document1.add(a3);
      LwgImage image = LwgImage.getInstance("iText.gif");
      image.setAnnotation(a3);
      document1.add(image);
            Annotation a4 = new Annotation(
                250f, 250f, 350f, 350f, PdfAction.LASTPAGE);
            document1.add(a4);
            // draw rectangles to show where the annotations were added
            cb1.rectangle(250, 700, 100, 100);
            cb1.rectangle(250, 550, 100, 100);
            cb1.rectangle(250, 400, 100, 100);
            cb1.rectangle(250, 250, 100, 100);
            cb1.stroke();
            // more content
            document1.newPage();
            for (int i = 0; i < 5; i++) {
              document1.add(new Paragraph("blahblahblah"));
            }
            document1.add(new Annotation("blahblah", "Adding an annotation without specifying coordinates"));
            for (int i = 0; i < 3; i++) {
              document1.add(new Paragraph("blahblahblah"))
            }
            document1.newPage();
            document1.add(new Chunk("marked chunk").setLocalDestination("mark"));
           
            // document2
      document2.add(new Paragraph("Each square on this page represents an annotation."));
            PdfContentByte cb2 = writer2.getDirectContent();
            Annotation a5 = new Annotation(100f, 700f, 200f, 800f,
                "cards.mpg", "video/mpeg", true);
            document2.add(a5);
            Annotation a6 = new Annotation(100f, 550f, 200f, 650f,
                "SimpleAnnotations1.pdf", "mark");
            document2.add(a6);
            Annotation a7 = new Annotation(100f, 400f, 200f, 500f,
                "SimpleAnnotations1.pdf", 2);
            document2.add(a7);
            Annotation a8 = new Annotation100f, 250f, 200f, 350f,
                "C://windows/notepad.exe", null, null, null);
            document2.add(a8);
            // draw rectangles to show where the annotations were added
            cb2.rectangle(100, 700, 100, 100);
            cb2.rectangle(100, 550, 100, 100);
View Full Code Here

    }

    String title = attributes.getProperty(ElementTags.TITLE);
    String text = attributes.getProperty(ElementTags.CONTENT);
    if (title != null || text != null) {
      return new Annotation(title, text, llx, lly, urx, ury);
    }
    value = attributes.getProperty(ElementTags.URL);
    if (value != null) {
      return new Annotation(llx, lly, urx, ury, value);
    }
    value = attributes.getProperty(ElementTags.NAMED);
    if (value != null) {
      return new Annotation(llx, lly, urx, ury, Integer.parseInt(value));
    }
    String file = attributes.getProperty(ElementTags.FILE);
    String destination = attributes.getProperty(ElementTags.DESTINATION);
    String page = (String) attributes.remove(ElementTags.PAGE);
    if (file != null) {
      if (destination != null) {
        return new Annotation(llx, lly, urx, ury, file, destination);
      }
      if (page != null) {
        return new Annotation(llx, lly, urx, ury, file, Integer
            .parseInt(page));
      }
    }
    return new Annotation("", "", llx, lly, urx, ury);
  }
View Full Code Here

                }
                case LwgElement.ANNOTATION: {
                    if (line == null) {
                        carriageReturn();
                    }
                    Annotation annot = (Annotation) element;
                    LwgRectangle rect = new LwgRectangle(0, 0);
                    if (line != null)
                      rect = new LwgRectangle(annot.llx(indentRight() - line.widthLeft()), annot.ury(indentTop() - currentHeight - 20), annot.urx(indentRight() - line.widthLeft() + 20), annot.lly(indentTop() - currentHeight));
                    PdfAnnotation an = PdfAnnotationsImp.convertAnnotation(writer, annot, rect);
                    annotationsImp.addPlainAnnotation(an);
                    pageEmpty = false;
                    break;
                }
View Full Code Here

            PdfWriter.getInstance(document, new FileOutputStream("annotated_images.pdf"));
            // step 3: we open the document
            document.open();
            // step 4: we add some content
            LwgImage jpeg = LwgImage.getInstance("otsoe.jpg");
            jpeg.setAnnotation(new Annotation("picture", "This is my dog", 0, 0, 0, 0));
      jpeg.setAbsolutePosition(100f, 550f);
      document.add(jpeg);
            LwgImage wmf = LwgImage.getInstance("iText.wmf");
            wmf.setAnnotation(new Annotation(0, 0, 0, 0, "http://www.lowagie.com/iText"));
      wmf.setAbsolutePosition(100f, 200f);
      document.add(wmf);
        }
        catch (Exception de) {
            de.printStackTrace();
View Full Code Here

TOP

Related Classes of com.lowagie.text.Annotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.