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

Adobe Acrobat form to be saved as a flat form

anciennes
Registered: Oct 5 2011
Posts: 9

I want the when saved to become flat. This is so the user cannot change any of the data. The only way that I can see that this can be done is for them to print the form as a pdf.
 
Is there any Adobe Javascript code that I can use behind a button that will in the background open their Print dialog box and click the OK button? This will then leave them with the Save dialog.

George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
It's far better to flatten the pages, which can be done using PDF optimizer, Preflight, or JavaScript. Flattening converts field (an other annotation) appearances to regular page contents and removed the fields. The following JavaScript will do it to all pages:

flattenPages();

There's also a nice free JavaScript-based utility that gives you more control over what gets flattened: http://www.uvsar.com/projects/acrobat/flattener/
Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Hi,

George, as far as I remember Reader can't flatten… Even with Extended Rights enabled…
;-)
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
That's right. I actually had typed that, but it wasn't clear if Reader was being used since the OP mentioned printing to PDF, which Reader can't do by itself either (on Windows, at least).
anciennes
Registered: Oct 5 2011
Posts: 9
Neither of these replies helps me at all.

There seems to be some important functionality missing in Acrobat. The form I am referring to is a membership form on a club website that has dropdown boxes that not only give choices to the prospective member but also, dependant upon those choices, will define what is displayed in other fields. The user will then send the form with his payment. There seem to be only two choices with an Acrobat form - to either not allow it be saved and the user then has to scan it or photocopy it for his own copy, or to allow the user to save it which means that he can then open it, change it and then not have a copy of what he submitted. Perhaps we should forget Acrobat (we are using the demo copy to see whether it will do what we want) and buy something else.
anciennes
Registered: Oct 5 2011
Posts: 9
Just in case you think that my problem is not a problem - it is ti th US courts see http://www.nmcourt.fed.us/usbc/files/convertinteractivepdffile.pdf
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
Well did you hear about the Federal Judge who did not want PDF's submitted to her court and told the attorneys appearing before her to to use Microsoft Word. The only problem was she had WordPerfect on her compute and had a hard time reading the MS doc file type.

The UCC, Uniform Commercial Code, has been revised for the use of digital signature certificates for commercial contracts. This form type can not only lock specified fields but also add special check coding to indicate if the document has been changed after the digital certificate has been applied.

The link is to a specialized court in New Mexico and might not apply to all U.S. Court Districts. At least that is how court decisions work. The decision in one U.S. District Court is not binding on any other U.S. Court District.

It is also possible to apply a digital certificate and apply passwords to a flattened PDF and provide a better check of the PDF than just flattening it. After all the flattened PDF could still be modified and the reviewers might not be aware that that has occurred.

The provided instructions fall short of supplying an unmodifiable document and does not even look at the features that could disclose any alteration to the PDF.

George Kaiser

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
anciennes, can't you use a submit button that locks all form fields to read-only mode?
Reader can do it.

A flatened PDF is not secure, any Mac user can edit and modify it using the free Apple software Preview, any Unix or Windows user can edit and modify it using a large choice of free softwares, and any Acrobat user too…

;-)
anciennes
Registered: Oct 5 2011
Posts: 9
Thus form is not being submitted electronically. It will be printed and put in the post and saved on the local pc (not on a server. Can a submit button be used to save the form to a local pc and lock all fields on saving? That is all that we want to do.
maxwyss
Registered: Jul 25 2006
Posts: 255
One thing you could do, if you have sufficient confidence into your users, would be adding a "Prepare Form for Sending In" button.

This button would do the following:

• setting all fields to read-only.
• printing the form on the default printer
• opening the Save as… dialog

(and maybe, to annoy the users, close the form after saving

This functionality would work in Reader, using the Acrobat Pro Extended Rights.

Hope this can help.

Max Wyss.

anciennes
Registered: Oct 5 2011
Posts: 9
How would you do this Max?

I do not know very much Adobe Javascript.

I can see that the button could be set for

Mouse Enter
Select a menu item
File>Print...Mouse Enter
Select a menu item
File>Save as ...>pdf...But I cannot see a Mouse Enter option for • setting all fields to read-only.

I haven't tried a button with the print and save as pdf options on it but would that mean that the button would need to be clicked twice.

If the best way to achieve the 3 things is by Javascript can you give me the script please.

Thanks


maxwyss
Registered: Jul 25 2006
Posts: 255
First and foremost, think about the event you would use; MouseEnter is definitely not the best choice if you want the user to click on the button…

In the MouseUp event of that button, add the following action:

Run a JavaScript:

code:

for (var i = 0 ; i < this.numFields ; i++) {
var mf = this.getField(this.getNthFieldName(i)) ;
if mf.type != "button") {
mf.readonly = true ;
}
}

this.print() ;

app.execMenuItem("SaveAs") ;


And that's about it.

It will make all non-button fields read-only, print using the Print dialog, and then pop up the Save as… dialog


Hope this can help.

Max Wyss.

anciennes
Registered: Oct 5 2011
Posts: 9
Sorry Max but this code gives a syntax error

Missing ( before condition3: at line 4
Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
Max: thanks for this useful piece of code.

Anciennes: this code is OK, I put the missing "(" at the right place:

for (var i = 0 ; i < this.numFields ; i++) {
var mf = this.getField(this.getNthFieldName(i)) ;
if (mf.type != "button") {
mf.readonly = true ;
}
}
this.print() ;
app.execMenuItem("SaveAs") ;
anciennes
Registered: Oct 5 2011
Posts: 9
Max thank-you for this piece of code. It does exactly what I wanted to achieve.
And thanks to Merlin for the code correction.

I really feel that this functionality is something that should be able to be done with Acrobat Pro. The saving as Reader Extended should have some choices about what can be done with the form and this should be one of them.

anciennes
Registered: Oct 5 2011
Posts: 9
Max thank-you for this piece of code. It does exactly what I wanted to achieve.
And thanks to Merlin for the code correction.

I really feel that this functionality is something that should be able to be done with Acrobat Pro. The saving as Reader Extended should have some choices about what can be done with the form and this should be one of them.

maxwyss
Registered: Jul 25 2006
Posts: 255
Thanks, Merlin for spotting the error … happens to me all the time…

anciennes: glad to hear that it was useful.

Max Wyss.

Merlin
Acrobat 9ExpertTeam
Registered: Mar 1 2006
Posts: 766
maxwyss wrote:
Thanks, Merlin for spotting the error … happens to me all the time…
Me too…
That's why I was able to repair it !

:-)))
anciennes
Registered: Oct 5 2011
Posts: 9
I now have 2 buttons one that saves a flat file and one that prints the file and saves the flat file.

I also have a text field that contains the wording

"If you have not completed the form but wish to save it to complete later then use the Acrobat Reader - File, Save a Copy menu option. You will then be able to open the form and continue. If you have completed the form then use either the Save or the Print and Save buttons on the right."