Page 1 of 1

Set Target of a existing GoToR IPXC_Action

Posted: Mon Nov 09, 2020 12:42 pm
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

Re: Set Target of a existing GoToR IPXC_Action

Posted: Mon Nov 09, 2020 2:48 pm
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

Re: Set Target of a existing GoToR IPXC_Action

Posted: Tue Nov 10, 2020 9:54 am
by Sasha - PDF-XChange
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

Re: Set Target of a existing GoToR IPXC_Action  SOLVED

Posted: Wed Nov 11, 2020 8:46 am
by zarkogajic
Alex,

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

-žarko

Set Target of a existing GoToR IPXC_Action

Posted: Wed Nov 11, 2020 9:00 am
by Sasha - PDF-XChange
:)