import java.io.FileOutputStream;
import java.util.HashMap;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.SimpleNamedDestination;
public class MainClass {
public static void main(String[] args) throws Exception {
Document remote = new Document();
PdfWriter.getInstance(remote, new FileOutputStream("remote.pdf"));
remote.open();
remote.add(new Paragraph("another"));
remote.newPage();
Paragraph p = new Paragraph("This paragraph contains a ");
p.add(new Chunk("local destination").setLocalDestination("test"));
remote.add(p);
remote.close();
PdfReader reader = new PdfReader("remote.pdf");
HashMap map = SimpleNamedDestination.getNamedDestination(reader, false);
SimpleNamedDestination.exportToXML(map, new FileOutputStream("remote.xml"), "ISO8859-1", true);
}
}
|