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 JavaScriptActionPDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("JavaScriptActionPDF.pdf"));
document.open();
Paragraph p = new Paragraph(new Chunk("Click to say Hi")
.setAction(PdfAction.javaScript("app.alert('Hi');\r", writer)));
document.add(p);
} catch (Exception de) {
de.printStackTrace();
}
document.close();
}
}
itext.zip( 1,748 k)