Friday, December 30, 2011

Anchor link page-citation in iText

We can give the link and page citation for or PDF file using itext....

For instead of generating pdf via xml and xslt, We can get from itext,

here also we can give link and page citation use of following classes.,

Font font = new Font();
font.setColor(Color.GREEN);
font.setStyle(Font.UNDERLINE);
docpdf.add(new Chunk("Chapter 1"));
docpdf.add(new Paragraph(new Chunk("Press here to go chapter 2", font).setLocalGoto("2")));// Code 2
docpdf.newPage();
docpdf.add(new Chunk("Chapter 2").setLocalDestination("2"));
docpdf.add(new Paragraph(new Chunk("http://www.maargasystems.com", font).setAnchor("http://www.maargasystems.com")));//Code 3
docpdf.add(new Paragraph( new Chunk("Open CreatePDFInlotus.pdf chapter 3", font).setRemoteGoto("D:\\Ram\\CreatePDFInlotus.pdf", "3")));//Code 4

No comments:

Post a Comment