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

custom save button

New Here ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

Hi Everyone. I am making a simple fillable form PDF and I want to put a save button that when pressed it will automatically set the name of the file to what is in the text field "Ebox Work Order Number" and save it to a folder on my network. Is that possible to do at all?

TOPICS
Acrobat SDK and JavaScript , Windows

Views

230

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 ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

Hi,

It's only possible if you write an application script, that means you will have to place a .js file in local on the computer of each user.

@+

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 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

even if the PDF form is stored on the network as well?? what would the application script look like? Because right now only 4 people would be filling out the form so I would be able to put that script on each computer.

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 ,
Mar 29, 2024 Mar 29, 2024

Copy link to clipboard

Copied

LATEST

Hi,

Sorry, I didn't notice your request!

Attached is an example with this script for the "SAVE AS" button:

if (/^[a-zA-Z0-9]+$/.test(this.getField("orderNumber").value)) {
	try {
		Save_orderNumber(this.path.substr(0,this.path.lastIndexOf("/")+1)+this.getField("orderNumber").value+".pdf");
		this.resetForm();
	} catch(e) {
		this.getField("theScript").display=display.visible;
		app.alert("The \"austin36331818118t.js\" file is not installed on this computer.");
	}
} else app.alert("Please enter a correct Order Number");
this.dirty=false;

For working, you must place a .js file in the JavaScript Acrobat  folder of each computer. You can name it as you want but it must contain this script:

Save_orderNumber=app.trustedFunction(function(newFilePath) {
	app.beginPriv();
	this.saveAs({
		cPath: newFilePath,
		bCopy: true,
		bPromptToOverwrite: true
	});
	app.endPriv();
})

Here, the new file will be saved in the same folder as the original file.

You can modify the condition of your order number or the parameters method.

@+

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 ,
Mar 26, 2024 Mar 26, 2024

Copy link to clipboard

Copied

If the form is for you, or for use on a computer you control, then yes you can. 

Read this article:

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

 

Saving is a restricted action in Acrobat.  To save to a specific file name requires a script, which can only be reliably run in Acrobat. So this feature can only be accomplished in Acrobat Pro/Reader on the desktop app, from a privileged script.

 

 

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