Forum How do I...?

use prince-bookmark-target to go to top of page

dsmith
I'm setting up pdf bookmarks in my documents and I've found that it doesn't work on the <head> tag, so I'm trying to get it to work with the <body> tag. However, instead of the bookmark pointing to the body location, I'd like for it to point to the top of page 1. Is it possible to do that with prince-bookmark-target or is there a better way to accomplish this. I only need one bookmark for the document and it should take me to the top of the 1st page. Thank you!
howcome
Your <body> element doesn't start at the top of the first page?

You can also abspos an element at the top of the first page and point to that element.
dsmith
No Sir. The pages all have headers and the document scrolls below them to the body when clicking the bookmark. I'll give the abspos idea a shot. Thanks!
dsmith
From the documentation it seems absolute positioning starts at the document body as well which lines up with what I'm seeing (still scrolls below the header). It was a good idea though!
howcome
Perhaps you can set negative values on abspos properties, like:
div { 
  position: absolute;
  top: -10mm;
  left: -5mm;
}

Edited by howcome

dsmith
Working perfect. Thank you very much howcome!