Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to get PDF file path?

Avatar

Former Community Member

Hi,

Adobe Livecycle ES2 V9

Here's the code I'm currently using (postSave):

var fileName = event.target.documentFileName;

// at this point, fileName is (myForm.pdf), there's no file path

fileName = fileName.substring(0, fileName.indexOf("."));

xfa.host.exportData("./" + fileName + ".xml", 0);

Basically, when the user saves the PDF an XML file is automatically saved in the same directory with the same name as the PDF.

The problem is event.target.documentFileName only gets the pdf and extension (ex: site_checklist.pdf)

If the client opens two or more PDFs, it tries to export the XML into the directory of the first opened PDF (or the last, haven't narrowed it down).

How can I get the filepath of the current PDF (not the most recently opened PDF)?

I can't find any documentation for .documentFileName, I've tried documentFilePath too.

1 Accepted Solution

Avatar

Correct answer by
Level 6
3 Replies

Avatar

Correct answer by
Level 6

Avatar

Level 10

The path is resolved with:

It includes the file name too, so if you have to remove it if neccessary with:

Avatar

Former Community Member

Thanks guys, I'll see if this resolves the problem.

EDIT: Seems to have fixed the problem.