Hello sir,
I want to add Bookmark into PDF. I got the Instance of a writer by
PdfStamper class instead of PdfWriter class.
I use following line of code...
PdfReader readCombine=new PdfReader("C:\\CombinePDF.pdf");
PdfStamper stamp=new PdfStamper(readCombine, new
FileOutputStream("C:\\CombinePDFStamp.pdf"));
PdfWriter writer=stamp.getWriter();
writer.setViewerPreferences(PdfWriter.PageModeUseOutlines);
PdfOutline root = writer.getRootOutline();
PdfOutline movieBookmark;
PdfOutline link;
movieBookmark = new PdfOutline(root,new
PdfDestination(PdfDestination.FITH,806),"Purchase Dep.",true);
movieBookmark.setStyle(Font.BOLD);
link = new PdfOutline(movieBookmark,new PdfAction("
http://www.google.com"),"link to Google");
link.setColor(BaseColor.BLUE);
movieBookmark = new PdfOutline(root,new
PdfDestination(PdfDestination.FITH, 806),"Admin Dep.", true);
movieBookmark.setStyle(Font.BOLD);
link = new PdfOutline(movieBookmark,new PdfAction("
http://www.google.com"),"link to Google");
link.setColor(BaseColor.BLUE);
List<HashMap<String, Object>> list =
SimpleBookmark.getBookmark(readCombine);
SimpleBookmark.exportToXML(list,new
FileOutputStream("C:\\CombinePDF.xml"), "ISO8859-1", true);
stamp.close();
and i got java.lang.NullPointerException error... how can I resolve this
issue??
Thanks & Regards,
--
*Anand Khatri*
Software Developer
ZEITECH Solutions,
Ahmedabad.
Ph : *+91 8000008071**
<http://www.intecllc.com/>*
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php