----- Original Message ----- From: "Jingrong Chen" <[EMAIL PROTECTED]> To: "Post all your questions about iText here" <itext-questions@lists.sourceforge.net> Sent: Thursday, October 12, 2006 9:26 PM Subject: Re: [iText-questions] exception in PdfContentByte.localDestination
> Hi, Paulo: > > I am getting confused. I am trying to read in a pdf file, create some > named destination then write out to a new file. > Are you saying it's not possible? > No, I'm saying that there's not an out-of-the-box solution. If you know about the pdf structure then it's possible to do it. Paulo > Thanks, > Jing > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Paulo Soares > Sent: Thursday, October 12, 2006 12:35 PM > To: Post all your questions about iText here > Subject: Re: [iText-questions] exception in > PdfContentByte.localDestination > > You can't create new named destinations unless you fiddle with > SimpleNamedDestination and that's not really trivial. You can however > make > plain GoTo page links. > > Paulo > > ----- Original Message ----- > From: "Jingrong Chen" <[EMAIL PROTECTED]> > To: "Post all your questions about iText here" > <itext-questions@lists.sourceforge.net> > Sent: Thursday, October 12, 2006 7:30 PM > Subject: Re: [iText-questions] [EMAIL PROTECTED] - Email > hasdifferent > SMTP TO: and MIME TO: fields in the email addresses- Re: exception in > PdfContentByte.localDestination > > >> Paulo: >> >> Thanks for your suggestions: >> I tried to Use PdfStamper instead of PdfCopy. No exception produced. > But >> the output file does not contain any named destination. What am I >> missing here? >> >> PdfStamper stamper = new PdfStamper( reader, new >> FileOutputStream("test.pdf")); >> >> PdfContentByte under; >> PdfDestination de; >> for (int i = 1; i < pages; i++) >> { >> under = stamper.getUnderContent(i); >> >> de = new PdfDestination(PdfDestination.FITR, 0, 0, 0, 0); >> under.localDestination("test", de); >> } >> stamper.close(); >> >> Thanks a lot! >> Jing >> >> -----Original Message----- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of >> Paulo Soares >> Sent: Wednesday, October 11, 2006 11:27 AM >> To: Post all your questions about iText here >> Subject: [EMAIL PROTECTED] - Email has different SMTP TO: and >> MIME TO: fields in the email addresses - Re: [iText-questions] > exception >> in PdfContentByte.localDestination >> >> PdfCopy doesn't allow to add any content, only full pages. Use >> PdfStamper. >> >> Paulo >> >> ----- Original Message ----- >> From: "Jingrong Chen" <[EMAIL PROTECTED]> >> To: <itext-questions@lists.sourceforge.net> >> Sent: Wednesday, October 11, 2006 7:25 PM >> Subject: [iText-questions] exception in > PdfContentByte.localDestination >> >> >> Hi, I am trying to read in a pdf file, add some named destination > then >> save them to a new file. >> >> Here's my code: >> >> int pages = >> reader.getNumberOfPages(); >> >> >> >> Document document = new Document( >> reader.getPageSizeWithRotation( 1 ) ); >> >> PdfCopy writer = new >> PdfCopy( document, new FileOutputStream("test.pdf") ); >> >> document.open(); >> >> String name = "test_destination"; >> >> >> >> for (int i = 1; i <= pages; i++) >> >> >> writer.addPage(writer.getImportedPage(reader, i); >> >> >> >> >> PdfDestination destination = new PdfDestination(PdfDestination.FITR, > 0, >> 0, 0, 0); >> >> >> PdfContentByte cb = writer.getDirectContent(); >> >> >> cb.localDestination(name, destination); >> >> >> PdfAction.gotoLocalPage(i, destination, writer); >> >> } >> >> document.close(); >> >> I keep getting the exception at the same place for each page: >> >> >> >> java.lang.IllegalArgumentException: Invalid page number 3 >> >> at >> com.lowagie.text.pdf.PdfCopy.getPageReference(PdfCopy.java:359) >> >> at >> com.lowagie.text.pdf.PdfWriter.getCurrentPage(PdfWriter.java:2164) >> >> at >> > com.lowagie.text.pdf.PdfDocument.localDestination(PdfDocument.java:2989) >> >> at >> > com.lowagie.text.pdf.PdfContentByte.localDestination(PdfContentByte.java >> :2489) >> >> >> >> What am I doing wrong here? Appreciate you help! >> >> >> >> >> > ------------------------------------------------------------------------ >> -------- >> >> >>> >> > ------------------------------------------------------------------------ >> - >>> Using Tomcat but need to do more? Need to support web services, >> security? >>> Get stuff done quickly with pre-integrated technology to make your > job >> >>> easier >>> Download IBM WebSphere Application Server v.1.0.1 based on Apache >> Geronimo >>> >> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >> >> > ------------------------------------------------------------------------ >> -------- >> >> >>> _______________________________________________ >>> iText-questions mailing list >>> iText-questions@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/itext-questions >>> >> >> >> > ------------------------------------------------------------------------ >> - >> Using Tomcat but need to do more? Need to support web services, >> security? >> Get stuff done quickly with pre-integrated technology to make your job >> easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache >> Geronimo >> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> iText-questions mailing list >> iText-questions@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/itext-questions >> >> >> >> >> >> > ------------------------------------------------------------------------ > - >> Using Tomcat but need to do more? Need to support web services, > security? >> Get stuff done quickly with pre-integrated technology to make your job > >> easier >> Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo >> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> iText-questions mailing list >> iText-questions@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/itext-questions > > > ------------------------------------------------------------------------ > - > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions > > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > iText-questions mailing list > iText-questions@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/itext-questions ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions