Simple Annotations: Draw Rectangle to Show Annotations : Annotations « PDF RTF « Java

Simple Annotations: Draw Rectangle to Show Annotations

Simple Annotations: Draw Rectangle to Show Annotations

import com.lowagie.text.Annotation;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfAction;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;

public class SimpleAnnotationsDrawRectangleToShowAnnotation {
  public static void main(String[] args) {
    Document document1 = new Document(PageSize.A4, 10, 10, 10, 10);
    try {
      PdfWriter writer1 = PdfWriter.getInstance(document1, new FileOutputStream("SimpleAnnotationsDrawRectangleToShowAnnotation.pdf"));

      Annotation a = new Annotation("authors", "Text for an annotation",250f, 250f, 350f, 350f);

      // draw rectangles to show where the annotations were added
      PdfContentByte cb1 = writer1.getDirectContent();
      cb1.rectangle(250, 700, 100, 100);
      cb1.rectangle(250, 550, 100, 100);
      cb1.rectangle(250, 400, 100, 100);
      cb1.rectangle(250, 250, 100, 100);

    } catch (Exception de) {
       1,748 k)

Related examples in the same category

1.Simple Annotations: Add Annotation without Specifying Coordinates
2.Simple Annotations: Local DestinationSimple Annotations: Local Destination
3.Simple AnnotationsSimple Annotations
4.Simple Annotations with Another PDF document
5.Simple Annotations with Application(Notepad.exe)
6.Simple Annotations with HyperLink In an ImageSimple Annotations with HyperLink In an Image
7.Simple Annotations with HyperLink
8.Simple Annotations with MpegMovie