These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Scripting an Automatic File Name in Save As...

Tylerama
Registered: Jul 9 2010
Posts: 5

Hello

Is there a way to place a code in a form that would generate an automatic Save As name (taken from a field in the form) when the user clicks on "Save As..."?

My Product Information:
Acrobat Pro 9.3.1, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Only by use of a special application level folder script. Thom Parker has written a tutorial about this.

George Kaiser

3rdparty
Registered: Jul 9 2010
Posts: 1
I'm looking to do the same thing using Acrobat OR Livecycle and am trying to get Radzmar's script to work: http://www.acrobatusers.com/forums/aucbb/viewtopic.php?pid=62025#p62025

@gkaiseril: do you have a link to Thom Parker's tutorial? I searched but wasn't able to find it.

Thanks
dmeurer
Registered: Jan 31 2006
Posts: 5
You can print the pdf through distiller as a postscript file. It converts the postscript to PDF and saves as a flat PDF of the completed state of the interactive form in the pre-defined directory. See example code. You need to setup a pass-through job in distiller to look in the input folder. the result of the job will be in the output folder. If this method may work for you, I can provide you with more details for the distiller settings.

Example:

var txtSiteA = this.getField("txtSiteA");
var txtDateTime = this.getField("txtDateTime");
var txtLastName = this.getField("txtLastName");
var txtFirstName = this.getField("txtFirstName");



if (txtSiteA.value == "HFS")
{
var pp = getPrintParams();
var fv = pp.constants.flagValues;
pp.flags = (fv.setPageSize | fv.suppressRotate);

//this is the indexed page in the active PDF file to print. like an ay, it begins at 0.
pp.firstPage = 2;
pp.lastPage = 2;

var d = txtDateTime.value;

//scand formats the dat and time from the date/time field
var e = util.scand("mmddyyyyHHMMss", d);
var printDate = util.printd("mmddyyyy_HHMMss", e);

pp.fileName = "/c/eTRIAGE_Encounters_Train/in/" + "eTRIAGE_" + txtSiteA.value + "_" + txtLastName.value + "_" + txtFirstName.value + "_" + printDate + ".ps";

pp.printerName = "";
this.print(pp);
}
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Refrying is not recommended procedure, unless you want degrade the look of the PDF. And I believe you can not silently print in a PDF.

Thom's article is in the Learning Center under JavaScript Tutorials.

George Kaiser

dmeurer
Registered: Jan 31 2006
Posts: 5
You can print a form silently from within a pdf form. the following is the command line that will print silently, though it must still be executed with an action.

this.print({bUI: false, bSilent: true, bShrinkToFit: true, nStart: 2, nEnd : 2});



Of note the 'refry' purpose is to save a final state of a completed form with a custom generated save name. All layers are flattenned. It looses none of its detail as a form that can be reprinted later.

The 'refry' is not really a 'refry' becasue it is sent as a postript file which is in turn printed as file and saved instead of being printed as a piece of paper. The advantage of printing to a file is that that file can be retrieved and printed as paper as many times as you want. It can be archived and is uneditable. Its purpose is to save a final state of an interactive form in an uneditable format that can be archived. Of course the data is saved in a database and the record can be recalled and edited witht he PDF in the application at which time it is resaved and a new updated file is saved in the archive.

alternatively, and in other cases, you can also render the saved data in crystal reports viewable/savable and printable as a PDF.

Somehow though, I do not think that this is the solution that the other user was looking for.