IPXC_Bookmark

PDF-XChange Editor SDK for Developers

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

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
jeffp
User
Posts: 861
Joined: Wed Sep 30, 2009 6:53 pm

IPXC_Bookmark

Post by jeffp » Thu Jun 23, 2016 3:07 am

Can you help me out with how to set a bookmark? I want to give the bookmark a title and the set it to a certain Page in the PDF.

Actually, it needs to be linked to the APage such that it will follow such PDF page in the event the Page gets reordered or inserted in another PDF.

This is where I'm stuck. I'm not sure if I'm creating this correctly.

Code: Select all

procedure TMyPDF.AddBookmark(APage: Integer; ATitle: String; APrepend: Boolean = False);
var
  BM: IPXC_Bookmark;
  AL: IPXC_ActionsList;
begin
  if Assigned(FDoc) then
  try
    FDoc.BookmarkRoot.AddNewChild(not APrepend, BM);
    BM.Set_Title(ATitle);
    //How do I set the Page??
    FDoc.BookmarkRoot.AddChild(BM, not APrepend);
  except end;
end;

User avatar
Sasha - Tracker Dev Team
User
Posts: 4941
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Bookmark

Post by Sasha - Tracker Dev Team » Thu Jun 23, 2016 6:33 am

Hello Jeff,

Please read the Bookmarks part (12.3.3 Document Outline) and the Actions part (12.6 Actions) in the PDF specification for better understanding. Also, try creating bookmarks in the End-User Editor and look into the Actions list for the clarification.
As you are using the Editor SDK then it's better to modify the action list with the operation:
http://sdkhelp.tracker-software.com/vie ... s_setProps
The action list should be created using the:
http://sdkhelp.tracker-software.com/vie ... ctionsList
The AddGoTo method should be used to add the appropriate GoTo Action:
http://sdkhelp.tracker-software.com/vie ... st_AddGoto

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

jeffp
User
Posts: 861
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Bookmark

Post by jeffp » Thu Jun 23, 2016 5:52 pm

This seems to do it in case anyone else is asking.

Code: Select all

procedure TMyPDF.AddBookmark(APage: Integer; ATitle: String; APrepend: Boolean = False);
var
  BM: IPXC_Bookmark;
  AL: IPXC_ActionsList;
  A: IPXC_Action;
  D: PXC_Destination;
begin
  if Assigned(FDoc) then
  try
    D.nPageNum := APage - 1;
    D.nType := Dest_XYZ;
    AL := FDoc.CreateActionsList;
    AL.AddGoto(D, A);
    FDoc.BookmarkRoot.AddNewChild(not APrepend, BM);
    BM.Set_Title(ATitle);
    BM.Set_Actions(AL);
  except end;
end;

User avatar
Sasha - Tracker Dev Team
User
Posts: 4941
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Bookmark

Post by Sasha - Tracker Dev Team » Fri Jun 24, 2016 6:44 am

Hello Jeff,

Yes, that's exactly what needs to be done. Though this will inherit all of the x, y and zoom from the current view when switching to the page .

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

jeffp
User
Posts: 861
Joined: Wed Sep 30, 2009 6:53 pm

Re: IPXC_Bookmark

Post by jeffp » Fri Jun 24, 2016 3:17 pm

What's your suggestion for

D.nType := Dest_XYZ; ?

What is the best setting here?

User avatar
Sasha - Tracker Dev Team
User
Posts: 4941
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: IPXC_Bookmark

Post by Sasha - Tracker Dev Team » Mon Jun 27, 2016 7:15 am

Hello Jeff,

Well the default recommended behavior would be to go to the top left corner of the page. Basically that will look like this:

Code: Select all

uint nPageNumber = 1;
PDFXEdit.PXC_Destination dest = new PDFXEdit.PXC_Destination();
PDFXEdit.PXC_Rect rc = pdfCtl.Doc.CoreDoc.Pages[nPageNumber].get_Box(PDFXEdit.PXC_BoxType.PBox_PageBox);
dest.nType = PDFXEdit.PXC_DestType.Dest_XYZ;
dest.dValues = new Double[4];
dest.dValues[0] = rc.left;
dest.dValues[1] = rc.top;
dest.nNullFlags = 12;
dest.nPageNum = nPageNumber;
pdfCtl.GoToDestination(ref dest);
Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply