Skip to main content
March 16, 2018
Answered

Combining pdf forms

  • March 16, 2018
  • 2 replies
  • 835 views

This is the first time I use javascript so I'm sorry if the question is just silly. I have three pdf forms (A,B,C) that I want to combine into one file. I would like to have three radiobuttons on the top of the form (A,B and C). Depending on which one would be chosen pdf form A,B or C would be displayed. The question is if there is a possibility to create some kind of panels in Acrobat XI or do I have to add visibility conditions for each object in the form?

This topic has been closed for replies.
Correct answer try67

You can insert the three files as layers and then show/hide them based on the selection. You will also need to separately show/hide the fields associated with each form, though.

2 replies

March 23, 2018

Hi, I have another basic question concerning this subject. I have managed to create pdf with layers (named aaa, bbb and ccc). and radiobuttons. I can change visibility of fields by using simple commands in radiobutton actions f.ex

Mouse Up -> Run a JavaScript -> this.getField("Text2").display = display.visible;

Nevertheless I cannot do the same with layers.

I took a shot with

this.getOCGs("aaa").state = true;

however it does not work (

RangeError: Invalid argument value.

Doc.getOCGs:1:Field Group1:Mouse Up)

Could you please show me how such a command should look like?

try67
Community Expert
Community Expert
March 23, 2018

The getOCGs method returns an array with all of the layers, as the name suggests. You can then iterate over that array, looking for a specific one, like this:

var ocgs = this.getOCGs();

for (var i in ocgs) {
     if (ocgs.name=="aaa") ocgs.state = true;

}

March 28, 2018

Thank you very much!

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 16, 2018

You can insert the three files as layers and then show/hide them based on the selection. You will also need to separately show/hide the fields associated with each form, though.

March 20, 2018

Thank you for the reply. I tried to add layers but as far as I see it cannot be done in Acrobat Standard XI (only in Pro). Am I right?

try67
Community Expert
Community Expert
March 20, 2018

I believe so, yes.