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

Button to print to ADobe PDF

Jesus
Registered: Mar 27 2007
Posts: 54

I'm developing a form that contains, drop down lists, signatures, javascrits and also will hace secondary documents appended to it. Then, the final form will be loaded to a Imaging Content management system. For that I need the form to be "flat", not dynamic(without the drop down list, no javascrits). I see that I can do that using File, print and then select Adobe PDF. This will giveme the flat document that I neet.
 
Tha question is, Can I have a button to do that without showng any dialog box to the user? Like the Doc.Saveas method...

My Product Information:
Acrobat Standard 8, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
No you can't. Not from a document script. The UI will always be presented to the user when "risky" functions are run from a document script. An alternative to "printing to PDF" is to use the "doc.flattenPages()" function. This function flattens all interactive elements into the page content, but doesn't strip out Document scripts. It also does not work in Reader.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Jesus
Registered: Mar 27 2007
Posts: 54
Hi Thom,

Thank for your response.

I'm trying using doc.flattenPeges() in a folder level JS. The code I'm using is this:

myflatten = app.trustPropagatorFunction(function(doc)
{
app.beginPriv();
var myDoc = event.target;
myDoc.flattenPages();
app.endPriv();
})
myTrustedSpecialTaskFunc2 = app.trustedFunction(function(doc)
{
// privileged and/or non-privileged code above
app.beginPriv();
myflatten(doc);
app.endPriv();
// privileged and/or non-privileged code below
});
//

But I get this message:
NotAllowedError: Security settings prevent access to this property or method.
Doc.flattenPages:7:XFA:topmostSubform[0]:Page1[0]:Button2[0]:click

Also I used this instruction in folder level JS:

this.flattenPages(0,this.numPages-1);

But I get the same error message.

Can you help me with this???

Thanks

Jesús