Paulo and Bruno -- thanks for the response to yesterday's question.  In
trying to implement the PdfStamper post-processor solution, though, I am
running into an inexplicable runtime error.  This is what I'm trying to
do (a simple proof of concept):

   PdfReader reader = new PdfReader(infile);
   PdfStamper stamp = new PdfStamper(reader, new
FileOutputStream(outfile));
   PdfContentByte over = stamp.getOverContent(1);
   over.beginText();
   over.setFontAndSize(bf, 18);
   over.setTextMatrix(100, 700);
   over.showText("Test");
   over.endText();
   over.localGoto("testdest", 150, 360, 250, 460);
   stamp.close();

The text displays fine, but I get a null pointer exception (referencing
PdfDocument.localGoto) at the call to localGoto().  I've tried placing
this inside and outside the beginText/endText block and I get the same
results either way.  I must be misunderstanding how to use this, but I
can't find any docs to explain the PdfContentByte.localGoto method.
Thanks again ...

-- Marc Stein
-- [EMAIL PROTECTED]


Paulo wrote:
> Merge the docs with PdfCopy. Use PdfStamper to insert blank pages and
> write the TOC.
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of Marc Stein
> > Sent: Wednesday, February 15, 2006 3:44 PM
> > To: [email protected]
> > Subject: [iText-questions] creating a clickable TOC for merged PDFs
> > 
> > I have searched the archives and found a few references to a 
> > critical problem I am having but I could not find a clear 
> > answer - any help would be much appreciated.
> > 
> > I am using iText to create a single PDF by merging a number 
> > of PDFs using PDFCopy.  I need to create a TOC (not 
> > bookmarks) at the beginning of this document with clickable 
> > links to the first pages of each of the source PDFs, and I am 
> > unable to make these links clickable.  Here are some of the 
> > things I've tried, and the results:
> > 
> > 1.       using setLocalGoTo in a TOC document and 
> > setLocalDestination in each source document, and then 
> > merging.  This produces a runtime error because, even though 
> > the local goto/destination references are identical, they 
> > originate in different documents and are thus invalid.  
> > 
> > 2.       using RemoteGoTo with a reference to the final 
> > output PDF name.  This works as long as the final PDF name is 
> > unchanged, but the links fail if the PDF name is changed.
> > 
> > 3.       using Actions or Annotations in place of LocalGoTo's 
> > - this has the same problem as LocalGoTo
> > 
> > 4.       using setLocalGoTo in the TOC and creating dummy 
> > destinations on a dummy page in the TOC with the same name as 
> > the destinations in the source documents, and then merging 
> > the TOC without including the dummy page.  This produces 
> > corrupted links after the merge because the page with the 
> > dummy destinations is not present.
> > 
> > 5.       Using PDFCopy instead of PDFWriter to handle all 
> > operations, and generating the TOC at merge time instead of 
> > before merge time.  This fails because apparently PDFCopy 
> > cannot be used in place of PDFWriter for all operations.
> > 
> > 6.       Postprocessing the merged document to add the links 
> > to the final PDF.  I cannot find a way to do this.
> > 
> > I am out of ideas - expert help would be greatly appreciated.

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log
files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=k&kid3432&bid#0486&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to