Page 1 of 1

Determining page number for a bookmark/anchor

PostPosted: Mon Aug 03, 2009 7:34 pm
by jbeltran
Hi,

Is it possible to know what page a bookmark (i.e. an anchor) falls on using docx4j? Our users want to be able to create bookmark, but they want the text of the link that refers to that bookmark to actually have the page number (i.e. if the bookmark falls on page 110, the link to that bookmark would say "110")

Any help would be greatly appreciated!

Thanks,
Justin

Re: Determining page number for a bookmark/anchor

PostPosted: Mon Aug 03, 2009 9:50 pm
by jason
In general, no.

However, if the document was created in Word, and you haven't changed it much, you can count w:lastRenderedPageBreak elements.

(Word can update page numbers in cross references, so if these are a page out, it probably won't matter if Word is the ultimate consumer)

For docx4j to calculate page numbers correctly in the general case, it would have to include a page layout model, which it doesn't have.

Re: Determining page number for a bookmark/anchor

PostPosted: Thu Aug 06, 2009 3:17 am
by dqkit
I had the problem too. I found lastrenderedbreak could be the page break marker, and sometimes <br> too!
so, what way to judge the end of the page ?
thanks for your reply.