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 MainClass { public static void main(String[] args) throws Exception { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream("2.pdf")); document.open(); Paragraph p1 = new Paragraph("this is a test"); p1.add(new Chunk(" another test ", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255))) .setLocalGoto("jump")); p1.add("the lazy dog."); Paragraph p2 = new Paragraph("test"); Paragraph p3 = new Paragraph("test 2"); p3.add(new Chunk(" has jumped ", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 255, 0))) .setLocalDestination(" cat ")); p3.add(" dog."); document.add(p1); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p2); document.add(p3); document.close(); } }