OK, no, I'm dumb. Coordinates are from the lower-left, dan. For the curious, to just go to the top of the page, use:
PdfAction bookmark = PdfAction.gotoLocalPage(1, // this is the page number! new PdfDestination(PdfDestination.XYZ, -1, -1, 0), writer); new PdfOutline(writer.getRootOutline(), bookmark, letter.getAttribute( "name" )); which, I believe, makes the PdfAction just say "go to this page, don't specify any coordinates". - d On 10/26/06, Dan Crosta <[EMAIL PROTECTED]> wrote: > It actually looks like it might be an issue with Adobe Reader -- a > different reader, Foxit Redaer 2.0, treats the bookmarks like I'd > expect it to. Any thoughts? > > - d > > > > On 10/26/06, Dan Crosta <[EMAIL PROTECTED]> wrote: > > When I create the outline and bookmark the way you suggest, actually > > hard-coding the value 1 in gotoLocalPage, the bookmarks all go to the > > very top of page 2. Is this a problem with the PDF reader (Adobe > > Reader 7.0.8 on win32)? > > > > Debugging shows that the PdfAction's hashMap member has value "{/D=[1 > > 0 R, /XYZ, 0, 0, 0], /S=/GoTo}"... I can't read PDF, so I don't know > > if this is correct. > > > > Actually, it looks like there might be an off-by-one error somewhere > > along the line. Debug printing says that I'm linking to pages 2, 4, 8, > > etc, and in Adobe Reader when I click the outline bookmarks, they go > > to the right place (except the first), and display the number that was > > debug printed. However, the actual page number that it goes to is one > > greater than what Adobe reader shows -- if you drag the window ever so > > slightly it refreshes its page number display to show 3, 5, 9, etc. > > Even more curious, the second time you click on a bookmark, it shows > > the correct page number in the display (3, 5, 9, etc), but goes to the > > same place as the last time you clicked it. The first bookmark is > > still incorrect -- it goes to the second page in the PDF. > > > > I'm sorry to be such a pain about this, I just feel like there's > > something subtle going on that someone more familiar with PDF might be > > able to diagnose. > > > > Thanks, > > - d > > > > > > > > On 10/26/06, Bruno Lowagie (iText) <[EMAIL PROTECTED]> wrote: > > > Dan Crosta wrote: > > > > > > > Which works except that the very first bookmark is on the top of page > > > > 2 (should be at top of page 1). Am I missing something? > > > > > > When you create a destination like in your code sample, > > > the destination points to the current page. > > > In your case, the current page is probably page 2. > > > > > > If you want the bookmark to point to page 1, > > > you need something like this: > > > > > > PdfAction bookmark = > > > PdfAction.gotoLocalPage(1, // this is the page number! > > > new PdfDestination(PdfDestination.XYZ, 0, 0, 0), > > > writer); > > > new PdfOutline(writer.getRootOutline(), > > > bookmark, letter.getAttribute( "name" )); > > > > > > best regards, > > > Bruno > > > > > > ------------------------------------------------------------------------- > > > 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