Simple Annotations with HyperLink : Annotations « PDF RTF « Java






Simple Annotations with HyperLink

import java.io.FileOutputStream;
import java.net.URL;

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 SimpleAnnotationsWithHyperLinkPDF {
  public static void main(String[] args) {
    Document document1 = new Document(PageSize.A4, 10, 10, 10, 10);
    try {
      PdfWriter writer1 = PdfWriter.getInstance(document1, new FileOutputStream("SimpleAnnotationsWithHyperLinkPDF.pdf"));
      writer1.setPdfVersion(PdfWriter.VERSION_1_5);
      document1.open();

      Annotation a = new Annotation(250f, 550f, 350f, 650f,
          new URL("http://www.java2s.com"));

      document1.add(a);
    } catch (Exception de) {
      de.printStackTrace();
    }
    document1.close();
  }
}
           
       








itext.zip( 1,748 k)

Related examples in the same category

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