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

The best way to create multiple check boxes....

Participant ,
Jan 10, 2025 Jan 10, 2025

over 40-odd pages in a document.

 

I can create multiple copies, but only to a maximum of approx 25 on one page.

 

I can duplicate the boxes over multiple pages, but then they are duplicates not individual fields so if I tick one box it'll tick them on all the other pages.

 

I want to keep the root name the same for all the checkboxes as I want to write a script at the end to summarise them all - but I can't do this if I copy and paste the checkbox.

 

Is there a better way of doing this, or do I just have to copy & paste my checkboxes and select fields at the end for the summary?

 

Thank you

TOPICS
PDF forms
3.5K
Translate
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 ,
Jan 10, 2025 Jan 10, 2025

Yes, there is. You can convert the page to a Template object and then spawn copied from it, with unique (but predictable named) field names on each copy. This requires using a script.

If you're interested, I've developed a (paid-for) tool that allows you to do it quickly and easily, without having to write any code yourself, and I'll be happy to help you set up the calculations after running the script, so you don't have to manually enter all the field names.

You can find it here: https://www.try67.com/tool/acrobat-duplicate-pages-of-a-pdf-file-including-form-fields

 

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Thank you! I think that's the script I meant to buy from you but got the wrong one. I will check it out, thank you. I don't think you can do Templates unless you have a very high tech version of Acrobat (from my googling).

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

Well, you need Acrobat Pro to be able to do it via the application's UI, but if you use a script it's possible to do it in both Acrobat Pro or Acrobat Standard, but not in the free Acrobat Reader... However, in Reader you also can't add form fields, so I don't think you have that.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

I have Pro but can't see an option to convert to a template anywhere inc. tools.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

It's under Tools - Organize Pages - Page Templates. But you can only create them there, not spawn them.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Thanks, and it looks like to spawn the templates I need a button to add to each page. Then when I click on the button I run the script. Unfortunately I can't afford your option at the moment!

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Hmm I've got it to spawn pages (great) but not fields which is what I was aiming for. Do I have to create the fields on an absolutely blank page?

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

- You don't need a button to add each page. You can run the code from the JS Console.

- I thought you added the fields already... If not, you need to add them (via Tools - Prepare Form) to the page you defined as a Template, and then spawn copies from it. The fields won't be added or changed automatically after the spawning.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Yes, the page I selected as a template already has fields on it, which are copied over; but it's also copied over/spawned all the text behind the fields, formatting, colour, etc. which doesn't work as each page is unique.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Also if you do it in the console, how does it know when you want to spawn the template?

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

> Also if you do it in the console, how does it know when you want to spawn the template?

When you execute that code, that's when it spawns the Template...

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

Yes, the Templates includes the entire page's contents, not just the fields.

If you only want to duplicate those it will be more difficult. Basically, I would use the built-in Duplicate Fields Across Pages command then another script to "rename" them (I use quotes because you can't do that directly, you have to remove them and create new field with the right names), OR you could use a script to create the fields from scratch in the right positions and the right names.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

Another option is to replace the spawned pages with a blank page, I guess... That will keep the fields in tact but remove the underlying page's content.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

It'd still be a blank page though and the text is already in place... still this is all very useful information for the future, so thank you.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

I think that's the simplest way for now; duplicating fields & then renaming.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

Can't you create all the checkboxes on page one using Create multiple copies, then cut and paste them to the other pages?  Are the checkboxes in the same location on every page?  If so you can run a script in the console to create the fields on every page.

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

More or less. They may require some jiggling but not much.

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

On page 1, create the first check box (named "Check Box" in this example);  Create multiple copies 25 down and 1 across.  Now you have Check Box.0 through Check Box.24.  Move the check boxes into place and run the following script in the console to create 25 uniquely named check boxes on pages 1 through 40 of the document in the same location as those on page 1:

var rects=[];
for(var i=0;i<25;i++)
{rects.push(this.getField("Check Box."+i).rect)}
var fldNum=25;
for(var i=1;i<this.numPages;i++)
{
for(var j=0;j<25;j++)
{
this.addField("Check Box."+fldNum,"checkbox",i,rects[j]);
fldNum++;
}
}
Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

Thanks so much for this!

 

I need approx 5 per page, for the next 40 or so pages. So I have created 5 copies down. I then put in the script but as it starts on page 5 and I have 5 fields, I've amended the script as below but nothing is happening which suggests that I have done it wrong!

 

I'm putting it in the console which comes up when I press CTRL+J, which I figure is where it should go...

 

var rects=[]; for(var i=0;i<4;i++) {rects.push(this.getField("LOC."+i).rect)} var fldNum=4; for(var i=5;i<this.numPages;i++) { for(var j=0;j<4;j++) { this.addField("LOC."+fldNum,"checkbox",i,rects[j]); fldNum++; } }

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

ETA I've added it to "document javascript strings", do I need to press anything to get it to run?

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

I don't know what that means.  Are you familiar with the JavaScript Console?

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

The script looks good.  "Nothing is happening" - It should either create the fields or throw an error.  Are you selecting entire code in the console before running it?

Translate
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
Participant ,
Jan 10, 2025 Jan 10, 2025

I have set it up as a button and then I click on that button to run the code.

 

I get this in the debugger:

 

Exception in line 1282 of function AFSimple_Calculate, script byteCodeTool
Exception in line 1 of function top_level, script Field:Calculate

TypeError: f is null
1282:byteCodeTool
TypeError: f is null
1282:byteCodeTool
TypeError: f is null
1282:byteCodeTool
TypeError: f is null
1282:byteCodeTool
TypeError: f is null
1282:byteCodeTool

Translate
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 ,
Jan 10, 2025 Jan 10, 2025

It looks like you have a lot of errors in your form.  Those errors have nothing to do with the script I provided.  Clear the console and run the script there.

Translate
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