Saving a Flat PDF w/ Field Filename & Current Date Time in new location
I am certain the below has been done 1,000s of times since this is a basic workflow activity.
I have read some other posts which go over the javascript folder level, the button event script, and LiveCycle Designer.
But I believe my confusion starts with my platform I am using to do this.
I know it is not hard, but I cannot figure out certain things that have become walls.
I am using Acrobat 11, Windows 7.
I can use Acrobat DC if required.
I believe LiveCycle Designer is no longer available or is being phased out.
But if required I can buy this license.
I do not know to what extent I can use Acrobat 11 to do what I want to do below.
This is the first area where I am confused. I do not know if I even have the proper tools to do this.
What I want to accomplish:
I have about 20 pdf documents I will be converting to pdf Forms.
These are basically inspection and quality forms for what I do.
The forms will not change overtime, they really are basic.
Right now I fill out the forms by hand, turn them in at the end of the day, and then they are scanned and put in the correct place on my server.
I want to automate that process a little.
I do not need to input the data into a database or anything like that.
I want to create Forms that:
1. I can save each one on a shop computer and the guys can access them to fill them out. I can manually set each computer up with the proper folder level javascripts.
2. I do not want the guys to be able to delete or revise the Form material. So I was going to make the pdf Form file attributes read only.
3. I want the guys to open the file then fill out the form. Once done they would click a button at the bottom of the page that does the below:
- flattens the pdf. I do not want to save a fill-able form of the fill-able form. I want a flat copy as if it were printed to the new location.
- saves the pdf to a specific location on our server. This address does not change.
- create a filename that has one of the form fields (a serial number) + date/time .pdf Bascially I want the filename to look like, 12345_Date-Time.pdf
The shop computers will have reader installed. Will they need Acrobat 11?
Below is what I have figured out so far, but I cannot get it to work. In the console I get "undefined" and nothing happens.
The below does not have anything to flatten the pdf before the "saveAs" function. I figured I would have to add something to force all the fields to read only.
I am copying all this stuff from other posts, so please do not think I know what I am doing. I am learning.
Javascript folder level
app.beginPriv();
// DateTime function
function myDateString() {
return util.printd("yyyymmdd_HHMMss", new Date());
}
// SaveAs Function
var SaveForm = app.trustedFunction(function(vdoc) {
var myPath = "/C/Users/User1/Desktop/" this.getField("Serial No").value + "_" + myDateString() + ".pdf";
vdoc.saveAs(myPath);
app.endPriv();
// Do you really want to do this?
doc.closeDoc();
});
"Submit" Button javascript, triggered by mouse up event
This code has yet to be tested since I have only run the above in the console.
I may have to use (event.target) instead of (this).
SaveForm(this);
=========================
Am I on the right track? Do I need to get LiveCycle Designer to do this correctly?
