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 PdfActionGotoLocalPage {
public static void main(String[] args) {
Document document = new Document();
Document remote = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PdfActionGotoLocalPage.pdf"));
document.open();
PdfAction action = PdfAction.gotoLocalPage(2, new PdfDestination(PdfDestination.XYZ, -1, 10000, 0), writer);
writer.setOpenAction(action);
document.add(new Paragraph("Page 1"));
document.newPage();
document.add(new Paragraph("Page 2"));
} catch (Exception de) {
de.printStackTrace();
}
document.close();
remote.close();
}
}
itext.zip( 1,748 k)