Retrieve Page from IPXC Bookmark in Pdf Document  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
RudiRo
User
Posts: 6
Joined: Mon Jul 24, 2023 6:50 am

Retrieve Page from IPXC Bookmark in Pdf Document

Post by RudiRo »

Hello Tracker Support Team,

I am trying to read Bookmarks from PDF and retrieving its Page-Number.

To retrieve the Page-Number right now, i am using a workaround to include the page-number in the title of the bookmark. Because the Bookmark-Title is acessible from the IPXC_Bookmark object.

The Bookmarks look like this:

Page:1 Title
Page:5 Title2
Page:10 Title3

Sample Code below:



var pxcInst = (PDFXEdit.IPXC_Inst)m_PdfInst.GetExtension("PXC");
m_Document = pxcInst.OpenDocumentFromFile(@"PathToSampleDocument", null);
uint ct = 0;
IPXC_Bookmark bookmark;
while (ct < m_Document.BookmarkRoot.ChildrenCount)
{
if (ct == 0)
bookmark = m_Document.BookmarkRoot.FirstChild;
else
bookmark = m_Document.BookmarkRoot.Next;

retrievePageNumberFromTitle(bookmark.Title);
ct++;
}


Background:
I want to split a self created PDF-Document with Bookmarks, the PageNumber of the Bookmarks can be different depending on the size of the Pdf-File. In the example above i would define the PagesRange like this:
"1-4,5-9,10-Pages.Count"
Giving me 3 Documents depending on the Bookmarks.

It's working using the workaround, but i am wondering if there is a method to retrieve the Page-Number directly from the IPXC_Bookmark object. And i don't have to use the Bookmark Title as a workaround.



Thanks in Advance

Rudi
zarkogajic
User
Posts: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: Retrieve Page from IPXC Bookmark in Pdf Document  SOLVED

Post by zarkogajic »

Hi Rudi,

A bookmark can have actions or not. If not, when you click it - nothing happens.

https://sdkhelp.pdf-xchange.com/vi ... rk_Actions

If there are actions assigned, those actions can do various things.

https://sdkhelp.pdf-xchange.com/vi ... ctionsList
https://sdkhelp.pdf-xchange.com/vi ... sList_Item
https://sdkhelp.pdf-xchange.com/vi ... PXC_Action
https://sdkhelp.pdf-xchange.com/vi ... ction_Type

A type of an action can be "Go to a page in the same document" - this is probably the one you are talking about.

If it is, then https://sdkhelp.pdf-xchange.com/vi ... ction_Goto and https://sdkhelp.pdf-xchange.com/vi ... _Goto_Dest and https://sdkhelp.pdf-xchange.com/vi ... estination "nPageNum" gives you the target page.

p.s.
For how to check the type of an action and how to cast the action to its type and get the destination: search this forum ...

-žarko
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Retrieve Page from IPXC Bookmark in Pdf Document

Post by Tracker Supp-Stefan »

Hello zarkogajic,

Many thanks for the above post and detailed help!

@RudiRo - please do let us know if the above helped!

Kind regards,
Stefan
RudiRo
User
Posts: 6
Joined: Mon Jul 24, 2023 6:50 am

Re: Retrieve Page from IPXC Bookmark in Pdf Document

Post by RudiRo »

Hello,

sorry for my late replay, had a lot of work piled up.
I think i can work with zarkogajic answer and will mark it as solved.
Thanks for the quick help

Rudi
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17960
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Retrieve Page from IPXC Bookmark in Pdf Document

Post by Tracker Supp-Stefan »

:)
Post Reply