Chained Actions
import java.io.FileOutputStream; import com.lowagie.text.Chunk; import com.lowagie.text.Document; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfAction; import com.lowagie.text.pdf.PdfWriter; public class ChainedActionsPDF { public static void main(String[] args) { Document document = new Document(); try { PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ChainedActionsPDF.pdf")); document.open(); PdfAction action = PdfAction.javaScript("app.alert('Welcome at my site');\r", writer); action.next(new PdfAction("http://www.java2s.com")); Paragraph p = new Paragraph(new Chunk("Click to go to a website").setAction(action)); document.add(p); } catch (Exception de) { de.printStackTrace(); } document.close(); } }