Set Target of a existing GoToR IPXC_Action  SOLVED

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, 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
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Set Target of a existing GoToR IPXC_Action

Post by zarkogajic »

Hi Support,

What would be the proper way to alter the Target of an existing GoToR action?

So, I have a Link annotation and it has a GoToR action. To get the target document I'm using:

Code: Select all

act : IPXC_Action;
fileSpec : IPXC_FileSpec;
pdfLinkTarget : string;
...
fileSpec := IPXC_Action_Goto(act).Target;
pdfLinkTarget := fileSpec.FileName;
So, if a document a.pdf has a link to b.pdf, both in the same folder, the "pdfLinkTarget" above would simply be "b.pdf".

I need to change the target for that action to "c.pdf".

Target (IPXC_FileSpec) property of IPXC_Action_Goto is settable - but I'm not sure how to go from "c.pdf" to IPXC_FileSpec ? That is: how to convert a relative file name to IPXC_FileSpec ?

p.s.
I see IPXC_Document has CreateFileSpec returning IPXC_FileSpec needing IAFS_Name.

I've tried using IAFS_Inst.DefaultFileSys.StringToName('c.pdf', 0, null);

but this fails with "the parameter is incorrect".

Seems like DefaultFileSys.StringToName expects the full file name.


-žarko
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Set Target of a existing GoToR IPXC_Action

Post by zarkogajic »

Hi Support.

Seems like CreateFileSpec2 is the way to go (accepts relative file name forpDIFileName) ?

If so, what should be used for pFSName parameter? InstAFS.DefaultFileSys.Name ?

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Set Target of a existing GoToR IPXC_Action

Post by Sasha - Tracker Dev Team »

Hello žarko,
zarkogajic wrote: Mon Nov 09, 2020 12:42 pm I see IPXC_Document has CreateFileSpec returning IPXC_FileSpec needing IAFS_Name.

I've tried using IAFS_Inst.DefaultFileSys.StringToName('c.pdf', 0, null);

but this fails with "the parameter is incorrect".

Seems like DefaultFileSys.StringToName expects the full file name.
That's exactly what you need. The StringToName method needs full path, or the Parent specified as a third parameter for relative path calculation.

Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Set Target of a existing GoToR IPXC_Action  SOLVED

Post by zarkogajic »

Alex,

Thanks. I ended up using CreateFileSpec2 as it accepts relative paths.

-žarko
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Set Target of a existing GoToR IPXC_Action

Post by Sasha - Tracker Dev Team »

:)
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply