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

Save fillable form using the "project title" form field data as the file name

New Here ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

I do not know javascript, but need to create a button action in a pdf form that will save the document using the "project title" form field data as the file name. Below is what I have pulled together and have no luck. When I hit save, nothing happens. I've read through the posts and see similar questions, but can't figure anything out. 

 

// Get the value of the form field
var fieldValue = this.getField("projecttitle").value;

// Create a file name using the form field value
var fileName = fieldValue + ".pdf";

// Save the PDF with the specified file name
this.saveAs(fileName);

TOPICS
JavaScript , PDF forms

Views

663

Translate

Translate

Report

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 ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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
New Here ,
Feb 12, 2023 Feb 12, 2023

Copy link to clipboard

Copied

Thank you; from what I've read, this needs to be a trusted function so I will review these tutorials. 

Votes

Translate

Translate

Report

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 ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

LATEST

Updated articles:

https://www.pdfscripting.com/public/How-to-Save-a-PDF-2.cfm

https://www.pdfscripting.com/public/Trust-and-Privilege-in-Acrobat-Scripts.cfm

https://www.pdfscripting.com/public/Using-Trusted-Functions.cfm

 

 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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