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

Acrobat scripting help. Want to know if there is a way to add multiple instances of a scripted form.

Community Beginner ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

I am a sign maker (printing-side) by trade, not much of a programmer. I am in the process of creating a new work order form for the company. Most of the jobs we do have multiple prints with multiple files and each has it's own dimensions, materials, etc.

 

l2a48tzlde171.png

 

So far I have made a form for a single print job (attached image). It contains information such as the print file name, print width, height, material to print on, substrate material, etc. I have it set up to calculate square footage which then calculates a billing price and a cost price depending on what material is selected, size, etc. All is working mostly as intended (got a few kinks to iron out still).

 

What I am trying to accomplish though, is to have a persistent form that has one of the above instances in it. On the persistent form would be a button that says something like "Add Print". Upon clicking the button, another instance of the above form would appear below the original one. Each time the Add Print button is clicked, another instance would appear. Each instance would allow for it's own print file information, all of the contained variables would correspond to the appropriate instance, and all instances would be contained within the persistent form.

 

I hope I make sense explaining this.

Can this be done in Acrobat? 

TOPICS
Create PDFs , How to , JavaScript , PDF forms , Print and prepress

Views

600

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 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Yes, it can be done by defining the page as a Template object and then spawning new copies of it.

You can even set a parameter that will automatically rename the fields on those new pages, so they are not copies of the originals. However, you would need to clear those fields after spawning the copy and the calculation scripts for them will have to take into account the names they will have. This is not a very simple task if you don't have any experience programming in Acrobat JavaScript, 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 Beginner ,
May 26, 2021 May 26, 2021

Copy link to clipboard

Copied

Thank you for the response. I am not a complete noob with programming, but I wouldn't call myself a programmer by any means. I have been using Unreal Engine for about 4 years now and using the visual scripting they have. Although I know it's not real programming, it has taught me variables, arrays, enums, switches, if statements, functions, data structures, etc. I understand how and when to use those things. I have been doing a JS bootcamp for the past few days to try and get a grasp on things and most of it is making sense.

 

I will look into the template object that you mention and hopefully I will be able to make sense of that. I understand where the issue will come though, since all of my existing scripts reference the specific form names.

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 26, 2021 May 26, 2021

Copy link to clipboard

Copied

If you search this forum for templates and spawn you will find plenty of info. The names of the renamed fields on the spawned pages are predictable (it contains some fixed strings, the Template name, the page number to which it was spawned and the original field name, basically), so it's possible to write a generic code that will calculate their value using other fields on the same page, even if you don't know that page in advance.

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 26, 2021 May 26, 2021

Copy link to clipboard

Copied

LATEST

That makes sense, 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