Aspose.words Bookmark.PageNumber

how would I go about getting the pagenumber where a particualar bookmark is on a WORD document.
I can get the bookmark quite easily…

Bookmark bookmark = srcDocument.Range.Bookmarks[bookmarkName];

but there is no PageNumber property like there is in Aspose.Pdf.Kit.Bookmark
Do I need to somehow use Aspose.Words.Viewer.PageEventArgs.PageNumber? if so how?

Also, if I convert a word document with bookmarks into a PDF, do the bookmarks translate into PDF bookmarks?

Hi

Thanks for your interest in Aspose.Words. Unfortunately, there is no way to determine number of page where bookmark is placed. Aspose.Words document represents content and formatting of a document, not its layout into lines and pages. This feature is called pagination and it is not released yet. Please see FAQ for more information.

Best regards.

Hello!

MS Word bookmark and PDF bookmark are completely different entities. In MS Word bookmark is a marked area in the document that can be referenced, read, replaced etc. It has start and end. In PDF bookmark is a point referenced by a TOC entry.

In PDF there are no bookmarks in MS Word meaning. But Aspose.Words implements some kind of mapping of bookmarks in the source documents when converting to PDF. Start nodes of bookmarks are output as text segments with segment IDs. End nodes are completely ignored. If a bookmark occurs at the point where text segment is not acceptable in PDF its output delays until it is acceptable. Normally this doesn’t break anything.

Try converting any document with bookmarks into Aspose.Pdf XML intermediate format. Open as text. You will see the following constructions:

This is what your bookmarks became. After conversion to PDF, say loading to Aspose.Pdf, you can programmatically access these segment identifiers via Aspose.Pdf API.

Regards,