These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

When click print button change layout position

smilem
Registered: Apr 1 2008
Posts: 101
Answered

Hi, I have a form where I have text fields to collect information. They are aligned to in certain way.
Now when user click print button I need to move the text fields next to each other.

Is it possible?

I think I need to paste some code in the print button to change the position of my text fields?

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

every object in a form has values for the x- and y-axis to define their position.

To get the current coordinates of a textfield select it in the design view and look into the bar a the bottom of Designer. There the object coordinates are shown.
Or switch to the XML-source.
The first line of an object shows the coordinates
<field name="Textfield1" y="50mm" x="140mm" w="62mm" h="9mm">
You can simply manipulate the position with the preprint and postprint event of your print button.

// Preprint - Place Textfield1 to new positionTextfield1.x = "10mm"Textfield1.y = "20mm"

// Postprint - Place Textfield1 to its original positionTextfield1.x = "140mm"Textfield1.y = "50mm"

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

smilem
Registered: Apr 1 2008
Posts: 101
Thanks, it works like I need it to.

Is it possible to pass the x and y variables so user can set it?

Tried, but it did not work.

// Preprint - Place Textfield1 to new position
TextField1.x.value = "TextField8.rawValue"


Also I would like to pass the size variables.

My page orientation is automatically set to landscape is it possible to set it to portait and set the page size using user entered page size?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well,

the problem is that the user only types a number but not a unit (inch, millimeters etc.) for the coordinates.
So the form can't be rendered correct.
But hey, you easily can solve this with some little changes into the pre print event script.

// Preprint - Place Textfield1 to new positionvar xAxis = xAxisField.rawValuevar yAxis = yAxisField.rawValue // Format the value to a string with the correct unit (in this case millimeters)TextFeld1.x = Concat(xAxis, "mm")TextField1.y = Concat(yAxis, "mm")

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

smilem
Registered: Apr 1 2008
Posts: 101
The correct concat is like this:

var xAxis = TextField1.rawValue
TextField2.rawValue = String.concat(xAxis, "mm")

Or for a dropdownlist

var xAxis = TextField3.rawValue
TextField4.rawValue = String.concat(xAxis, DropDownList1.rawValue)