Source Code : Pdf Local Goto

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Pdf Local Goto

Pdf Local Goto
import java.awt.Color;
import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class LocalGotoPDF {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("LocalGotoPDF.pdf"));
      document.open();
      Paragraph p1 = new Paragraph("If you click on ", FontFactory.getFont(FontFactory.HELVETICA,
          12));
      p1.add(new Chunk("this word", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL,
          new Color(0, 0, 255))).setLocalGoto("test"));
      p1.add(" you will automatically jump to another location in this document.");

      Paragraph p2 = new Paragraph("Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text");

      Paragraph p3 = new Paragraph("This paragraph contains a ");
      p3.add(new Chunk("local destination", FontFactory.getFont(FontFactory.HELVETICA, 12,
          Font.NORMAL, new Color(255, 0, 0))).setLocalDestination("test"));

      document.add(p1);
      document.add(p2);
      document.add(p3);
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    document.close();
  }
}
           
       

Thank with us