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

deselect Auto-Rotate and Center Flag

smilem
Registered: Apr 1 2008
Posts: 101
Answered

Hi, I'm looking for how to change the "Auto-Rotate and Center" to make it deselected by default.

My print button has this code:

xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 1, 0, 0);

var pp = this.getPrintParams();
var fv = pp.constants.flagValues;
pp.flags = fv.setPageSize=false;//Sets the Auto-Rotate and Center Flag
this.print(pp);

Found this http://www.acrobatusers.com/forums/aucbb/viewtopic.php?pid=59719

But it does not seem to work?

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

please read this thread.
It's explains how to get the Acrobat JavaScript work in Designer.

[url]http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=23429[/url]

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

smilem
Registered: Apr 1 2008
Posts: 101
radzmar wrote:
Hi,please read this thread.
It's explains how to get the Acrobat JavaScript work in Designer.

[url]http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=23429[/url]
I looked at your code midification and tried to adapt the code from acrobat API

"Uncheck Auto-Rotate and Center (checked by default) in the Print dialog box."


My code for "print button" click now looks like this:



xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 1, 0, 0);

var MyDoc = event.target;

var pp = MyDoc.getPrintParams();
var fv = pp.constants.flagValues;
pp.flags |= (fv.suppressCenter | fv.suppressRotate);
MyDoc.print(pp);



But now when I click the button I the checkbox is not unticked and second print window pop-up once I close the first. If I remove the like "var MyDoc = event.target;" the second window pop-up is no more but the check box still does not uncheck.

Thanks.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
You made a mistake.
This code line
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 1, 0, 0);
is the print method of Designer, that does not allow to change the parameters "suppessCenter" and "suppressRotate".
You don't need it here.

Only use the AcroForms print method.
var MyDoc = event.target; var pp = MyDoc.getPrintParams();var fv = pp.constants.flagValues;pp.flags |= (fv.suppressCenter | fv.suppressRotate);MyDoc.print(pp);

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

smilem
Registered: Apr 1 2008
Posts: 101
Thanks

Since I want to print my document as image I added line

pp.pageHandling = pp.constants.handling.none;
pp.printAsImage = true;

Is it correct? By the way do you know how to set Page size at preprint event?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
1. For me this script works to print as an image

var MyDoc = event.target; var pp = MyDoc.getPrintParams();var fv = pp.constants.flagValues;pp.flags |= (fv.suppressCenter | fv.suppressRotate);pp.pageHandling = pp.constants.handling.none;pp.printAsImage = true;MyDoc.print(pp);

2. You can switch between different masterpages with the pre/post print event.
Therefore you first need to create at least two different master pages (MP1 and MP2) with the individual sizes.
Rename the content areas for each master page to the format you have chooses (for example A4 and A5).
Then create a new page and change it's pagination setting for "place" to "In Content Area 'A4' ".
You now can change the masterpage with the pre-/post print events with the following code.

// PrePrintxfa.form.form1.page1.break.beforeTarget="MP2.A5";

// PostPrintxfa.form.form1.page1.break.beforeTarget="MP1.A4";

Here a little example for you.
[url]https://acrobat.com/#d=wDBWqBR7v*GIMRbdet2KWQ[/url]

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

smilem
Registered: Apr 1 2008
Posts: 101
I have renamed my MP1 "content area" to "custom"
I have added new MP2 and renamed content area to "A4"

Then I have added new page Insert -> New page
Object -> Pagination ->Place "In content Area A4 "Code for preprint
xfa.form.form1.page1.break.beforeTarget="MP2.A4";

Code for postprint
xfa.form.form1.page1.break.beforeTarget="MP1.custom";


Problems, the positioning of items in preprint and post print stopped working. I have 2 pages listed in print preview. So doesn't that mean will have second page print blank?

I thought that it's possible to make second page for positioning only.
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
I dodn't have a problem to combine the script for the repositioning of form objects and the change of a master page.
I just added the code lines for the positioning to the script from my example.
Works like a charm.

xfa.form.form1.page1.break.beforeTarget="MP2.A5";Textfield1.x = "20mm";Textfield1.y = "20mm";

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

smilem
Registered: Apr 1 2008
Posts: 101
Since the forum does not allow attachments I sent you email. Please reply and I'll attach my file.

By the way can second page be used for positioning only? So no empty pages would get printed?
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Well,

you made some mistakes.

1. The second blank page is unneccessary and can be deleted.
2. The reference to your page is wrong, because your page is unnamed, this means it has the reference "subform[0]" not "page1".
3. Same mistakes to the masterpages, cause they are named "Page1" and "Page2" not "MP1" and "MP2".

So this syntax can't work:
xfa.form.form1.page1.break.beforeTarget="MP2.A4";
If you rename the untitled page to "MyPage" for example and correct the reference to the master pages it should look like:
xfa.form.form1.MyPage.break.beforeTarget="Page2.A4";
4. The page pagination setting for the page is wrong.
Correct the "place parameter" to "In content Area 'custom' ".

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs