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

Save PDF File Name as Field Name in PDF

Explorer ,
May 29, 2015 May 29, 2015

Copy link to clipboard

Copied

Hi all,

I've read through this thread : https://acrobatusers.com/tutorials/how-save-pdf-acrobat-javascript ‌ and I still can't figure this out.

I want to have a custom save button on my fillable form PDF, and have it save the file name with the fields in my form.  The field names are "RequestedBy" , "NameofEvent" , "EventStartmdyy"

so as an example, the pdf is filled out and returned to me with its default pdf name as "Event Request Form Update-1.pdf" , then I get it, and click the button, then it saves it as "DarinVegasTradeshowJune152015.pdf" and saves to a specific folder every time.

I read about getting trusted access and put it into a javascript either in the folder or on my computer? My co-worker and I will be the only person to save these, so it's only on two machines.

Hope you can assist.

Thank you

Views

42.1K

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

correct answers 1 Correct answer

Explorer , Jun 01, 2015 Jun 01, 2015

I tried the following;

The correct syntax I got, based on the debugger for "this.path" returned

/HAUCACAM0007VS/Shares/Marketing_bridge/Darin/`MasterTracker/EventRequestForms/1/test.pdf

so I changed the code from this

// determine the directory path for the current document 

var directory = this.path.substring(0, this.path.lastIndexOf('/') +1); 

to this

// determine the directory path for the current document 

var directory = "/HAUCACAM0007VS/Shares/Marketing_bridge/Darin/`MasterTracker/EventRequest

...

Votes

Translate

Translate
New Here ,
Feb 12, 2016 Feb 12, 2016

Copy link to clipboard

Copied

Split into multiple folders.   What I am trying to achieve is to have our customers fill out a form, press a button to save sections of the forms to different file paths. 

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

Copy link to clipboard

Copied

That is only possible if they have Acrobat (ie, not the free Reader), and you install a script on their local machines, and the folder-paths are known in advance.

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

Copy link to clipboard

Copied

Thank you so much for your help!  This will be done on several employees laptops which will have Acrobat.  I will have to set up the file structure on their computers and load the script trusted script to their JavaScript program file, but that is easily done since it is only a handful of employees. The idea is to try and save some backend time by creating an automation script that will allow the handful of employees to handle a high volume of customers in a limited amount of time.  The first step was trying to figure out how to save the files based on a form field.  The next step is having pages 1 and 2 save in a different location from pages 3 and 4.  I am not sure where to begin looking for this.

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

Copy link to clipboard

Copied

Read about the extractPages method of the Document object. That's basically all you need to use (from a privileged context, of course).

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

Copy link to clipboard

Copied

I have figured out how to write a script that will extract the sections of the document and save them as a custom file name.  But how would I use this as a privileged context?

This is my extract script:

this.extractPages({nEnd:1, cPath: "/c/temp/"+this.getField("UNID").value+ "W4.pdf"});

This is my Privlige Script:

var mySaveAs = app.trustedFunction(

  function(oDoc, cPath, cFlName) {

  // Ensure path has trailing "/"

  cPath = cPath.replace(/([^/])$/, "$1/");

  try {

  app.beginPriv();

  oDoc.saveAs(cPath + cFlName);

  app.endPriv();

  } catch (e) {

  app.alert("Error During Save - " + e);

  }

  }

);

I tried to call on to my Save As function in the extract script but it didn't return any results.

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

Copy link to clipboard

Copied

Use the structure of the mySaveAs function and create a new function that executes the extractPages command based on the parameters you provide it (the document object, the page numbers and the path).

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 ,
Sep 02, 2016 Sep 02, 2016

Copy link to clipboard

Copied

Hi everyone,

I've created my pdf form and kept the file on Dropbox.

When i open the file and edit it, it saves on my dropbox with a new name. The SAVE button works perfectly on Windows.

However, when i try to edit the file on an Ipad or Android, the save button don't work?

Can anyone please help?

Thank you in advance!!

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 ,
Mar 10, 2021 Mar 10, 2021

Copy link to clipboard

Copied

I am attempting to do the same thing.  I see that this thread is from 2015.  Do the same rules still apply?

 

I need a javascript that will extract 3 form fields (Name, District, Birthdate) from my pdf and rename it, then place it as an attachment in an email with that file name (name_district_birthdate). Then, I need it to email it to specific individuals. Is this possible?

 

Thank you for your assistance.

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