Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to use the User's Documents folder in Javascript?

Community Beginner ,
Jan 05, 2020 Jan 05, 2020

This works fine in the Javascript area of a pdf document:

this.exportAsXFDF({cPath:"/C/My folder/2020/File.XFDF",bAnnotations:true})

 But I don't know how to change the C/My folder/2020/File.XFDF to The User's Document folder/2020/File.XFDF?

TOPICS
Acrobat SDK and JavaScript
947
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jan 14, 2020 Jan 14, 2020

Today I worked on it and it and used a variable for the user documents map and filename. Then checked it with the app.alert function. And then put the variable after cPath and it workes fine. (Windows 8.1).

Translate
LEGEND ,
Jan 05, 2020 Jan 05, 2020

The things available to you are deliberately limited and deliberately locked out of embedded JavaScript, but check out app.getPath, it looks like it is designed to return what you need.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 05, 2020 Jan 05, 2020

Yes, you can get it using this code, but you have to run it from a privileged context:

app.getPath("user", "documents");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 07, 2020 Jan 07, 2020

Thank you for your reply, but I don't know where the privileged context is, only where the Javascript area of a pdf document is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 07, 2020 Jan 07, 2020
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 14, 2020 Jan 14, 2020
LATEST

Today I worked on it and it and used a variable for the user documents map and filename. Then checked it with the app.alert function. And then put the variable after cPath and it workes fine. (Windows 8.1).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines