Text Annotations : Annotation « PDF « Java Tutorial






import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfAnnotation;
import com.lowagie.text.pdf.PdfWriter;

public class MainClass {

  public static void main(String[] args) throws Exception {
    Document document = new Document();
    PdfWriter writer = PdfWriter
        .getInstance(document, new FileOutputStream("2.pdf"));
    document.open();
    writer.addAnnotation(PdfAnnotation.createText(writer, new Rectangle(50, 780, 70, 800),
        "Comment", "This is a Comment", false, "Comment"));
    writer.addAnnotation(PdfAnnotation.createText(writer, new Rectangle(100, 780, 120, 800),
        "Help", "This is a Help ", true, "Help"));
    document.close();
  }
}








29.34.Annotation
29.34.1.Add Annotation
29.34.2.Annotated Images
29.34.3.Text Annotations
29.34.4.PdfAnnotation and Javascript