Java tutorial
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(); } }