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

Using mixed forms in templates

Explorer ,
Jul 08, 2019 Jul 08, 2019

Hello,

when creating new pages from templates in PDF I have two options. Either all form fields get new names and therefore have individual data, or all fields keep their names and therefore get the content of fields with the same name.
What can I do with a template in which I want to have the same data in the header of each page (identical names of the fields), but also fields that should be individual?

TOPICS
PDF forms
985
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 ,
Jul 08, 2019 Jul 08, 2019

I can think of a couple of options:

- Spawn the pages with unique field names but use a script so that those specific fields that you want to have the same value always copy their value from the original field.

- Do not put any fields on your Template pages and add the fields using a script after spawning a copy (this is going to be problematic in Reader, though).

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
Explorer ,
Mar 04, 2020 Mar 04, 2020

Hello and thanks. I found a way to script it.

But I have an other problem. At the bottom I created a textfield for page numbers. The script looks as follows:

var dlst = this.getField("DropList1");
var tf = this.getField("DocPages");
var xval = 0;
var langs = new Array();
var AnzSeiten = this.numPages;
var DieseSeite = event.target.page + 1;

// Sprachtexte
langs[0] = "Seite " + DieseSeite + " von " + AnzSeiten ;

langs[1] = "Page " + DieseSeite + " of " + AnzSeiten ;

langs[2] = "Страница  " + DieseSeite + " из " + AnzSeiten ;

xval = parseInt(dlst.value);
tf.value = langs[xval];

---------

Now, my problem ist that the pdf contents the first page and a hidden template. After opening the document, only the first page is present, but my textfield shows "Page 1 of 2" instead of "Page 1 of one".

What is wrong?

Thanks in advance.

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 ,
Mar 04, 2020 Mar 04, 2020

Spawning a template can create a new page, it can also put fields over an existing page, so:

1. Spawn a new page from a template that renames the fields, as usual.

2. Spawn header fields,  without renaming fields, from another template over the new created page.

 

You must use the bOverlay parameter: https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJ...


Acrobate du PDF, InDesigner et Photoshopographe
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
LEGEND ,
Mar 04, 2020 Mar 04, 2020

This is what I do.

 

Some people have trouble creating a blank page that doesn't have a white background, but a simple way is to use the doc.newPage method via the JavaScript console to add a new blank page to the document, and then place the header fields on the resulting blank page, and then make it a hidden 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 ,
Mar 04, 2020 Mar 04, 2020
LATEST

I think JR has the best approach. Use two templates, one for the main (unique) form fields and one for the shared form fields.

 

 

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

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