Pdf action: jump locally : PDF Action « PDF RTF « Java






Pdf action: jump locally

Pdf action: jump locally
import java.awt.Color;
import java.io.FileOutputStream;

import com.lowagie.text.Anchor;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.FontFactory;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class JumpLocalDestinationPDF {
  public static void main(String[] args) {
    Document document = new Document();
    try {
      PdfWriter.getInstance(document, new FileOutputStream("JumpLocalDestinationPDF.pdf"));
      
      document.open();

      Paragraph paragraph = new Paragraph();
      Anchor anchor1 = new Anchor("some text", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.UNDERLINE, new Color(0, 0, 255)));
      anchor1.setName("top");
      paragraph.add(anchor1);
      document.add(paragraph);
      
      Anchor anchor2 = new Anchor("please jump to a local destination", FontFactory.getFont(FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255)));
      anchor2.setReference("#top");
      document.add(anchor2);
      
    } catch (Exception e) {
      System.err.println(e.getMessage());
    }
    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.Chained ActionsChained Actions