Placing a PDF bookmark to the index page?

Using `\usepackage{hyperref}`and the `\pdfbookmark[0]{...}{...}` command you can place a PDF bookmark just before the index page generated with `\printindex` (Sometimes it will point to the empty page before the index.) How can one place a bookmark exactly to the Index title?

After reading the answers so far, I have to refine the question a bit it seems.

I have now noticed two things that escaped me at first:

• The index is always placed on an odd page. (May be common knowlegde but wasn't for me :-)
• If the even page before the index has text on it, then the bookmark placed before `\printindex` will point to the index page. If there is an empty (even) page inserted, then the bookmark will point to this empty page instead of the index page.

I also should have provided the construct that places the index in our custom document class:

`````` \AtEndDocument{
\pdfbookmark[0]{\indexname}{bookmarkForTheIndex}
\printindex
}
``````

Note that I found something talking about AtEndDocument and the index, but I fear I do not quite understand it ... http://www.tug.org/TUGboat/Articles/tb19-1/tb58works.pdf

-

`\printindex` starts a `theindex` environment, which by default calls `\twocolumn`, which - and this causes your problem - starts a new page. The following should do the trick:

``````\cleardoublepage
\pdfbookmark[0]{\indexname}{idx}
\printindex
``````

Although I haven't tested it on a MWE, this doesn't work for me. The bookmarks in the toc and the pdf bookmarks both hyperlink to the first entry in the index, not at the `\indexname` header as it should. Somehow there's some magic tucked within your `idxlayout` package. I'll have to disassemble it someday. In any event, it works for me. I guess I owe you a good Aussie "thanks mate!" – Geoffrey Jones Sep 8 '10 at 16:40
This one's easy, or at least it finally was for me. It used to drive me crazy. I'd injected every piece of code I could imagine into `\printindex` to try to get it right. I came very close with careful use of `hyperref` `\phantomsection` along with a customised `\Hy@raisedlink`. But it never felt completely perfect. Then I discovered our good friend lockstep's `idxlayout` package, using it like this: `\usepackage[unbalanced,totoc]{idxlayout}`. Now everything is sweet.
I have not tried the `idxlayout` package since it's not part of our internal MikTeX distribution and adding it would be a major administrative headache at the moment. – Martin Sep 9 '10 at 7:19