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.PdfDestination;
import com.lowagie.text.pdf.PdfWriter;
public class PdfActionGotoLocalPage1 {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PdfActionGotoLocalPage1.pdf"));
document.open();
document.add(new Paragraph("Page 1"));
document.newPage();
document.add(new Paragraph("Page 2"));
document.add(new Chunk("goto page 1").setAction(PdfAction.gotoLocalPage(1, new PdfDestination(PdfDestination.FITH,500), writer)));
} catch (Exception de) {
de.printStackTrace();
}
document.close();
}
}
|