Copy link to clipboard
Copied
Hi all,
I found this tutorial online which is exactly what I want to do, but it's from 2013 and some of the features/steps I cannot find. By chance has adobe made this an easier task?
On a mac.
https://acrobatusers.com/tutorials/how-to-build-a-button-that-creates-a-new-page
Copy link to clipboard
Copied
How do I get it so that the button appears on each additional page
Put the button on the template pages.
How do you stop the form from repeating the information in the fields on the additional pages?
You should read the tuto or the JavaScript reference about the bRename method.
Copy link to clipboard
Copied
I read the tutorial and set the bRename to "true", but it still comes through as above.
"BRename: If true, it renames all form fields contained in the model page by adding the prefix P #. Model-name. In the new generated page, where # is the sequence number. So the identical fields do not have the same name on the new pages generated, which allows them to have different contents. Otherwise (false) the identical fields are not renamed in the new generated pages and they share the same content. Of course, this parameter is useful only if the document contains form fields, which is not always the case."
Copy link to clipboard
Copied
The parameter is "bRename". Capitalization is important in JavaScript.
Copy link to clipboard
Copied
If your template is visible and you spawn it, even if you set the fields to be renamed, the new fields will still have the same values as the originals.
You will need to reset them in your code after spawning the page to avoid that.
Copy link to clipboard
Copied
Where can I find the bRename tutorial? I can't find it anywhere. I'm very interested in this. Thank you.
Copy link to clipboard
Copied
See above.
Copy link to clipboard
Copied
All this is explained in the tutorial, it should be read…
Copy link to clipboard
Copied
JR_Boulay I have read the tutorial. Maybe I'm losing something from the french to english translation? but it seemed like I followed it. Understanding a lot of it I'm not quite sure. This is not a comfort area for me (obviously). Trying to learn as I go. Actually I used the button and script from the tutorial. Copied it over so there were no discrepancies. but still ended up with the example that I posted above a few comments ago.
gkaiseril Feb 6, 2017 2:36 PM (in response to Richard DiMaio)
You are creating the blank form and then making that into a template which can be hidden and used to create a new form page.
1. Create the form.
2. Make form into template.
3. Spawn new page from template with form fields renamed.
4 Rename form fields on the generated form to be prefixed "P0.".
5. Hide template page.
So to clarify The form is 2 different pages. One that involves the scope of the work and the second (and possible additional pages) would be the recommendations from the various architects, engineers, etc..
The second page would have an "add page" button for the reviewers to add additional comments.
So here's a question: If my additional pages are a duplicate of the second page can the second page be the template and NOT be hidden? Every time I add the duplicate to be used for additional pages I get this prompt. I have no idea how the portfolio function works with a fillable form.
here is the script that I am using:
this.getTemplate("page1").spawn({nPage:this.numPages, bRename:true, bOverlay: false});
Copy link to clipboard
Copied
Can you share your PDF?
(Acrobat : File menu : Send File : Send & Track : Create anonymous link)
Copy link to clipboard
Copied
I do not think that legally I can share city government documents that have not been approved for publication in an open forum. Which makes this even more frustrating. I'll see if I can redact the pertinent information.
Copy link to clipboard
Copied
When I first spawn the page from the visible template, I open the "Prepare Forms" and in the form list, arrange the field names alphabetically and then rename the "P1" fields to "P0". Then I hide the template.
I create a visible page from the template so the fields have the same structure of any other spawned page. This makes the scripting for the spawned pages exactly the same for each visible page. Also with the blank template there is no need to clear the fields on the spawned pages.
Copy link to clipboard
Copied
OK, I'm going to break down what you wrote and please correct me if I'm wrong.
• Spawn page from original template? do you mean adding the file and designating it as a template?
- adding the "P0" I get
• hide template, got it
• create a visible page from the template? duplicate the template page and make it visible? does it stay visible when all is done?
Copy link to clipboard
Copied
You should end up with the template invisible.
1. Create form.
2. Convert to template.
3. Spawn a new page.
4. Rename the form fields on the new page form "P1...." to "P0....".
5. Hide template.
Copy link to clipboard
Copied
Thanks! One last question before I delve further. I see the word "spawn" in the javascript, but how are you referring to spawning?
Copy link to clipboard
Copied
It is a method of the template object
The button's script creates an object that is the hidden template an then "spawn" a new page using the hidden template. By using the hidden template I do not need to worry about a user filling im any fields on the template.
Copy link to clipboard
Copied
Got it! That sample template worked great! totally understood it. THANK YOU!!!
Copy link to clipboard
Copied
OK, one last issue:
Usually when I save a form I go to File/Save as other/reader extended PDF/enable more tools (include form fill-in & save)...
yet when I do that the button no longer works. Should I be saving this in another way?
Copy link to clipboard
Copied
Hello. I was facing the same problem and tried this fix. While it has solved the problem of same field's input not repeating in the new generated pages, my problem that the new pages are generated in the last page remains. See I have a 8 pages Form. The action button "Add Page" is located in the third page and I need the new pages to be generated just after this page (not in the last) with different field names. I can not seem to figure out what I need to change in the script to do this. If I change the 'this.numpage' to 3, new pages are generated after page 3 but they have the same filed names. I am using the below script for now where pages are generating at the last with differnet field names. Please suggest what I need to change.
// define variable for the named MyTemplate;
var SpawnPage = this.getTemplate({cName: "Page 3(1)"});
// spawn the new page and rename the field names;
SpawnPage.spawn({nPage: this.numPages, bRename: true, bOverlay: false});
// set focus to new page Name field;
this.getField("P" + (this.numPages - 1) + ".MyTemplate.Name").setFocus();
Copy link to clipboard
Copied
Spawning pages works only with Reader XI (11) and Reader DC, and not with older versions*.
Reader XI (11) and Reader DC don't requires a "Reader Extended" PDF to be able to save it.
And, I don't know why, using "Reader Extended" features prevent spawning pages to work with Reader XI (11) and Reader DC.
So, just "Save as" your form.
But you may want to add a warning message for Reader X (10) and older versions users…
* Spawning pages works with any version of Acrobat Pro or Standard, "Reader Extended" or not.
.
Copy link to clipboard
Copied
Awesome! So far no problems but of course someone always throws a wrench in the works:
Lets say I have a form that on the second page has an area for comments from (for example) an architect. In past we've used word which everyone has been familiar with and people like the fact that the form field and borders carry over to the next page without them having to do anything. I'm guessing that is not possible with acrobat?
As we are moving towards removing word documents and using pdf's there's pushback because we're trying to reduce the verbosity for easier processing.
-After the reviewer inputs their comments the consultant has an area to include their response, which in word could carry over for multiple pages as well.
-I wanted to create 2 buttons on the review page. One to add a page for reviewer comments and one for the consultant to add additional comments should they run out of room.
Question: if the consultant wants to add a comments to a document that has already grown to 7 pages (thanks to the reviewer), is it possible to have their comments page be inserted after each page they're commenting on or will all the additional pages be added to the end of the document?
Copy link to clipboard
Copied
Here's a question:
I have the add page thing down. It's working great, but what about adding calculations? I just did a test run and the fields my added page comes up as P1.MyTemplate.(fieldname) but the calculations don't carry over. when I looked at the properties the P1.Mytemplate in the calculations area don't carry.
Copy link to clipboard
Copied
Can you add more than one page to a template. I have a document with 14 pages. I need to offer the option to add an additional page 5&6 and then 7&8. Currently, I have it set up so that each page will populate singularly through a button but I need them to populate at a certain spot in the document. This seems to get tricky when you are giving the option of adding four additional pages. If they add too many of page 5, won't that screw up the spawn position of additional pages?
TIA for any help with this!
Copy link to clipboard
Copied
No. You have to create a separate template for each page.
And no, you can spawn as many copies as you want to all the templates in your file. They don't interfere with one another.
Copy link to clipboard
Copied
Hello, do you know if the JavaScript to add an extra page will pass the Adobe accessibility check? TIA!
Copy link to clipboard
Copied
Not likely.