I am trying to read in a PDF file
so that I can place a date stamp on all of the page. The problem I am
having is with copying the bookmarks from the pdf file that is read in into
the new pdf file. I am able to preserve remote bookmarks and page
bookmarks but I am having trouble getting named destination bookmarks to
work. Could you send me a code example that would show me how I can copy
a named destination bookmark into the new pdf and get it to
work.
I am currently trying to do
this.....
HashMap map =
reader.getNamedDestination ();
Set c = map.entrySet()
;
Iterator it =
c.iterator();
while
(it.hasNext())
{
Map.Entry entry =
(Map.Entry)it.next();
PdfArray pdfArray = (PdfArray)entry.getValue();
ArrayList aList = pdfArray.getArrayList();
PdfIndirectReference o = (PdfIndirectReference)aList.get(0);
PdfDestination des = new PdfDestination(PdfDestination.FIT, -1, 10000,
0);
boolean boo = des.addPage(o);
if (boo)
{
System.out.println(cb.localDestination((String)entry.getKey(),
des));
}
}
When I close the document I get an
null pointer exception
ExceptionConverter:
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfWriter.getNewObjectNumber(Unknown
Source)
at com.lowagie.text.pdf.PRIndirectReference.toPdf(Unknown
Source)
at com.lowagie.text.pdf.PdfArray.toPdf(Unknown Source)
at com.lowagie.text.pdf.PdfIndirectObject.writeTo(Unknown
Source)
at com.lowagie.text.pdf.PdfWriter$PdfBody.add(Unknown
Source)
at com.lowagie.text.pdf.PdfWriter.addLocalDestinations(Unknown
Source)
at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
at com.lowagie.text.Document.close(Unknown Source)
Thanks for the
help,
Brett
______________________
Brett
Badinger
Sr Information Systems
Technologist
L-3
Communications
Integrated
Systems
(254) 867-7821
[EMAIL PROTECTED]