How can I automatically generate a new page in my PDF form?

Is there a way to automatically add a blank page to my PDF form so people can add additional information if they need to?


Patty Friesen


3 Answers

Voted Best Answer


Some of you may not know what "templates " arein terms of Acrobat and PDF forms, but you are probably familiar with paperbased forms you've filled out that noted "Please use the back side toprovide additional information" when a question requires more room than is allowed for onthe form ( think job applications, medical histories, etc). So, what do you do for a "back side forextra information" with an electronic PDF form? Adobe Reader XI comes to the rescue with theaddition of the new "Page Template" feature.



Spawning a template basically means you are dynamicallyadding a new page to your PDF. Youaren't creating a new page from thin air- the Page Template must already be apage in the PDF ( hint- it can be a hidden page so the end user never sees ituntil it's needed). This means that youcan add anything from a blank page to a page with graphics and form fields-anything on the Template is duplicated on the spawned page. And in case you missed it in the firstparagraph, this works in the free Adobe Reader XI! This is really powerful stuff. Adding this featureto your PDF form is relatively simple but does require a couple steps and ascript (don't get scared away, this is an easy one).



Here are the basic steps to add this dynamic feature toyour PDF form. Open your form to thepage you want to spawn. Go to Tools-Document Processing-Page Templates, namethe template "MyTemplate" and click OK. Now add a button with a caption somethinglike "Add A Page" to your form and place it where you want the userto see they can add an additional page. In the Properties dialog for the button under the Action tab selectMouse Up for the trigger and Run a JavaScript for the action. Click the Addbutton.

Enter this code in the script window-



var a = this.getTemplate("MyTemplate");

a.spawn (this.pageNums);



This code adds the Template Page to the end ofthe document. Simple. But, this feature is way more configurable. You can insert a spawned template anywhereyou want in the document. You can alsospawn an overlay on an existing page- lots of ways to use this cool newfeature. For details, look up theTemplate object in the official Acrobat JavaScript Reference (http://www.adobe.com/devnet/acrobat.html)


Hope this helps,

Dimitri
WindJack Solutions
www.pdfscripting.com
www.windjack.com


By Dimitri Munkirs   

Your users will need any version Acrobat, the paid product, or Adobe Reader XI, the free product, to use Acrobat's templates.

If your users can not update to Reader XI, then you will need to look at dynamic forms using LiveCycle Designer.


George Kaiser   

I have endured a whole world of hurt with spawning templates, but at least my users can work with them in Reader because I have the expensive Reader Extensions. The biggest problem though is navigation - there does not seem to be a way to retain bookmarks on spawned templates. Here's what I do - create the templates that I want added, have them all together in one pdf, and then create templates though the Template Manager. I then hide those templates. I then have a button to spawn those templates. All works a treat. BUT... anything spawned does not retain a bookmark, and in Reader users cannot create their own, so any ideas are out there?


Robert Evans   


Please specify a reason: