Chained Actions : PDF Action « PDF RTF « Java






Chained Actions

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








itext.zip( 1,748 k)

Related examples in the same category

1.PdfAction: Goto Another Pdf FilePdfAction: Goto Another Pdf File
2.PdfAction: Goto Local Page 1PdfAction: Goto Local Page 1
3.PdfAction: Goto Local Page 2PdfAction: Goto Local Page 2
4.Pdf action: open application (notepad.exe)Pdf action: open application (notepad.exe)
5.Named Actions in PDF DocumentNamed Actions in PDF Document
6.Pdf action: jump locallyPdf action: jump locally