I have created a form template that needs to be flattened, saved and emailed. At the bottom I inserted a form button to do this, assigned an action (mouse down) and inserted the script. However, the button changes briefly when pressed, but it does not appear to run the javascript. The same script works fine when assigned an icon and placed on the toolbar. I've never used the "button" before or the javascript feature. And, yes, I have JavaScript enabled in my preferences. Any ideas?
The script is as follows:
Flatten(false,65536)
SaveAs("pdf")
Email()
Your commands are not in JavaScript, they are built-in commands in Bluebeam and won't work where you put them.
I'll split this into two parts: 1.What you can do in JavaScript 2.What you can do with BlueBeam
If you absolutely want a button on your PDF, go with #1. If it's you and your team, and you don't mind adding another button on your toolbar, go with #2.
1.
Here is what I found with some success. Keep in mind I'm relatively new to this coding language.
For your Flatten:
this.flattenPages();
Note that you will not be able to unflatten.
Also if you want a specified range of pages, add something like:
this.flattenPages({
nStart: 0,
nEnd: this.numPages - 1,
);}
Flatten always worked for me.
For the e-mail:
this.mailDoc({
bUI: true,
cTo: "me@myself.ca",
cCc: "",
cSubject: "I am the one who e-mails",
cMsg: "This is a message \n",
});
It worked, but not all the time. Something in the background is blocking it, I'll check this at some other time. Otherwise, It should work fine.
Saving..... is another matter...
this.SaveAs("/C/Users/User_name/MyDocuments/" + "apple_juice.pdf");
Should have worked but it didn't
2.
In the
Document or
Batch menu select
Script.
Click on the Plus Sign " + " of the
Script Manager.
Name the script however you like and choose the icon you want.
Copy and paste your functions in the
script box.
Flatten(false,65536)
SaveAs("pdf")
Email()
Press "Ok" select it under
Scripts and press
Run.
It should work as intended.
You can get your script onto your toolbar. It is under the
Script Category in the
Customize Toolbar menu.
If you have any questions, let me know. I assume you are on the latest version of the software.