That localGoto is trying to create a named destination called
"testdest".

Paulo 

> -----Original Message-----
> From: Marc Stein [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, February 22, 2006 3:47 PM
> To: Paulo Soares; [email protected]
> Subject: RE: [iText-questions] problem with PdfContentByte localgoto
> 
> 
> I'm also confused because you say below that PdfStamper 
> doesn't support
> adding named destinations -- but the code fragment I am showing is
> trying to add a localGoto, not a destination.  In the case I'm
> describing, the destinations already exist, and I am trying to
> post-process this PDF using PdfStamper to create a TOC to these
> destinations.  
> 
> This is what you told me earlier, when I described what I am trying to
> do:
> 
> > Paulo wrote:
> > > Merge the docs with PdfCopy. Use PdfStamper to insert blank pages
> and
> > > write the TOC.
> 
> -- Marc Stein
> -- [EMAIL PROTECTED]
> 
> -----Original Message-----
> From: Paulo Soares [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, February 22, 2006 7:49 AM
> To: Marc Stein; [email protected]
> Subject: RE: [iText-questions] problem with PdfContentByte localgoto
> 
> PdfStamper doesn't support adding named destinations although you can
> call existing ones. In your case just call PdfAction.gotoLocalPage(int
> page, PdfDestination dest, PdfWriter writer).
> 
> Paulo
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of Marc Stein
> > Sent: Tuesday, February 21, 2006 5:03 PM
> > To: [email protected]
> > Subject: [iText-questions] problem with PdfContentByte localgoto
> > 
> > 
> > I apologize for reposting this question, but I have 
> continued to test
> > and I am unable to find any resolution to the problem I 
> > described below.
> > I think the following patch of code is simple and 
> self-contained, and
> > yet it results in a null pointer error when I run it.  Can somebody
> > please tell me if I am misunderstanding how to use
> > PdfContentByte.localGoto(), or missing something obvious?  
> > 
> >    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();
> > 
> > As I described previously, this runs successfully and 
> > displays text when
> > the localGoto() call is removed, but once the localGoto() call is
> > executed the program crashes.  I've tried a few variations 
> > and I always
> > get the same result.
> > 
> > Thanks.
> > 
> > -- Marc Stein
> > -- [EMAIL PROTECTED]
> > 
> > 
> > 
> > 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On 
> Behalf Of Marc
> > Stein
> > Sent: Thursday, February 16, 2006 3:28 PM
> > To: [email protected]
> > Subject: RE: [iText-questions] creating a clickable TOC for 
> > merged PDFs
> > 
> > 
> > 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=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=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=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