cancel
Showing results for 
Search instead for 
Did you mean: 

ImageField - set the same properties of ALL elements.

Former Member
0 Kudos

Hi guys,

We currently need to show some photos on our .pdf forms when the form is generated. The number of pictures are unknown at design time and need to be determined dynamically. This is not the problem - we figgured this out by using base64 encoding for retrieving these picture.

Now, when we try to display all of these picures on the .pdf we would like to have control over the width and size of these pictures ( the h and w properties.). The problem is that only the VERY FIRST picture gets applied these properties that we set, and all the following pictures are the size as per design time.

This is obviously do to us not knowing how to "loop through" this node in JavaScript/FormCalc. Please help! Also, which event should we use?

This is the code we are using:

xfa.form.pdfFields.Notification.SubformPhoto.Table9.Row1.ImageField2.h

=

"4in";

xfa.form.pdfFields.Notification.SubformPhoto.Table9.Row1.ImageField2.w

=

"4in";

We thought that the following should work to apply the values for all the elements, but this does not work.

xfa.form.pdfFields.Notification.SubformPhoto.Table9.Row1.ImageField2[*].h = "4in";

xfa.form.pdfFields.Notification.SubformPhoto.Table9.Row1.ImageField2[*].w = "4in";

Thanks!

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

you can try the following code.

Select "Events with Scripts" in the Show drop down list

Select "JavaScript" in the Language drop down list

Run at: "Client" as shown below.

var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);

var total = 0;

for (var i=0; i <= fields.length-1; i++)

{

if (fields.item(i).name == "PRICE")

{

fields.item(i).h = "4"

}

}

Former Member
0 Kudos

Hi,

you can try the following code.

Select "Events with Scripts" in the Show drop down list

Select "JavaScript" in the Language drop down list

Run at: "Client" as shown below.

var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);

var total = 0;

for (var i=0; i <= fields.length-1; i++)

{

if (fields.item(i).name == "PRICE")

{

fields.item(i).h = "4"

}

}

chintan_virani
Active Contributor
0 Kudos

Christian,

Try following code on form:ready event and see if it helps:-

	for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) 
	{ 
		var oFields = xfa.layout.pageContent(nPageCount, "field"); 
		var nNodesLength = oFields.length; 							
		for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) 
		{ 
			oFields.item(nNodeCount).h = "4in"; 
			oFields.item(nNodeCount).w = "4in"; 
		} 
    }

This will modify all form objects like TextFields, Buttons etc so am hoping you don't have anything extra than imagefields in the form

Chintan