• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
1

How can you duplicate pages without having the fields read each other?

Community Beginner ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

I have a 2-page form that needs to be repeated 14 times (making it 28 pages long in total). Instead of creating the fields 13 more times, I tried to duplicate the pages, but then realized that makes all of the editable fields repeat once you type something in. I've been googling and reading community threads for a while now and seem to only get halfway there. I understand there is a way to do it by creating page templates, but I that isn't working. And people have said that I need to enter in javascript code, which I do not know how to do either.


Can anyone help with a user-friendly solution? Thank you!!

TOPICS
PDF forms

Views

39.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

In "Prepare Form" mode, Select all the fields you want duplicated and right click to show the popup menu. Towards the bottom there is an option for duplicating across pages.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

Thank you! I just tried that and the fields still read one another though.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

Wow, I didn't test it. Sorry about that. I Just figured that if Adobe went through the trouble of making a function to specifically duplicate across pages that it would rename them. Makes that feature kind of useless doesn't it.

I guess Try67's tool is the only option.

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

You can do it very easily using this tool I've developed: Custom-made Adobe Scripts: Acrobat -- Duplicate Page (including Form Fields)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

You need to have the same fields on each page BUT each one must have an unique name, otherwise they share their content.

When you right-click on a field in Acrobat Pro, you can:

"Duplicate across pages" : does what it says, without renaming fields.

"Create multiple copies" : does what it says and rename fields, but only on one page.

So:

- Create a big sized blank new PDF, let's say an A0 format (you can use this free tool).

- Cut and paste all your fields into this new PDF.

- Select all fields : Right-clic : Create 14 multiple copies (this is why you need a big sized PDF).

- Cut and paste each of the 14 group of renamed fields into your 14 pages.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 20, 2018 Feb 20, 2018

Copy link to clipboard

Copied

As you mentioned, setting up a template and executing a simple script is an option. When you first set up each of the initial pages as a template page, you'll give each a name, such as P1 and P2. You can then execute the following JavaScript code in the interactive JavaScript console (Ctrl+J) to create 13 additional copies of P1 and P2. The fields will be renamed so they are independent.

// JavaScript to create duplicate pages from templates P1 and P2

var num_copies = 13;  // Set the number of copies here

var T1 = getTemplate("P1");  // Use the actual tempate name here

var T2 = getTemplate("P2");  // Use the actual tempate name here

if (num_copies > 0) {

    var oXObjT1 = T1.spawn({nPage: numPages, bRename: true, bOverlay: false});

    var oXObjT2 = T2.spawn({nPage: numPages, bRename: true, bOverlay: false});

    if (num_copies > 1) {

        for (var i = 1; i < num_copies; i += 1) {

            T1.spawn({nPage: numPages, bRename: true, bOverlay: false, oXObject: oXObjT1});

            T2.spawn({nPage: numPages, bRename: true, bOverlay: false, oXObject: oXObjT2});

        }

    }

}

To execute the code, select it all and press Ctrl+Enter, or Enter on the numeric keypad

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 21, 2018 Feb 21, 2018

Copy link to clipboard

Copied

Thank you! This is making more sense. I really appreciate all of your help!!! It worked!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 07, 2019 May 07, 2019

Copy link to clipboard

Copied

Hi!! You were so helpful last year -- thank you! I have to do this project again this year, and I am a little rusty. Everything is working except that for some reason when I close out of the document and open it back up, the document goes from 28 pages to 54. Even if I delete them, they reappear once I open it back up again. Any ideas? Thank you!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

Did you insert the code into the file? You should only use it from the Console window.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

Yes, I put it in the document javascripts section. I think what's happening is that it's running the script every time I open the file

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

Yes, that is what happens. You don't need to put it there.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

Oh, whoops! I'm VERY new at this. Where should I put the script so it doesn't do that?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

Place it and execute it in the interactive JavaScript console. Press Ctrl+J to open it. More info in my previous reply.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

Hmmm, I can't seem to figure out the JavaScript console. And my work-arounds still seem to cause the issue. I believe I found a very roundabout way that works. Thank you!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2019 May 08, 2019

Copy link to clipboard

Copied

You can also attach the code to the MouseUp event of a button field, click it and then delete the field.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 08, 2019 Nov 08, 2019

Copy link to clipboard

Copied

Hi there, 

 

I have multiple drop down fields and text fields on the page #1. For some reason when I duplicate the pages with the above code the drop down fields are still linked while the text fields are not. All fields on both pages have unique names and are still linked even if I rename them?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 09, 2019 Nov 09, 2019

Copy link to clipboard

Copied

Can you share the file?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 12, 2019 Nov 12, 2019

Copy link to clipboard

Copied

HELLO, THANKS FOR THE HELPFUL CODE!

 

EACH TIME I ATTEMPT TO RUN THIS CODE, I RECEIVE THE FOLOWING MESSAGE:

TypeError: T1 is null
11:Console:Exec
undefined

WHAT DOES THIS MEAN? 

P.S. i AM ATTEMPTING THIS CODE WITH A SINGLE PAGE TEMPLATE.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 12, 2019 Nov 12, 2019

Copy link to clipboard

Copied

It means there's no Template object with the name you provided.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2019 Nov 13, 2019

Copy link to clipboard

Copied

Okay, i figured out how to make the document a template, but now the Java is telling me 

"undfined" 

I only have a single page to duplicate, so I removed the "T2" fields, did this screw me up?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 13, 2019 Nov 13, 2019

Copy link to clipboard

Copied

When you get only "undefined" then it is OK.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2019 Nov 14, 2019

Copy link to clipboard

Copied

When a script returns "undefined" it's not an error, quite the opposite. It means it finished executing without any errors, but also without returning any values.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2020 Mar 27, 2020

Copy link to clipboard

Copied

Hi, I need to duplicate pages in a form and the client wants a "Duplicate Page" button on these particular pages. So far, I've made a template page, added a "duplicate page" button to the form page I need to replicate, and added your code into the Actions section of the button properties. The button does duplicate the page, which is awesome! It doesnt rename the fields but each page still seems to responds independantly, which seems weird but I'm not complaining!  🙂

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 27, 2020 Mar 27, 2020

Copy link to clipboard

Copied

LATEST

If bRename is set to true the fields will be renamed on the spawned pages.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines