Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

auto fit-width of form on open

Avatar

Level 2

I have created a fillable form that has an orientation of landscape.  When we open it in Internet Explorer, it fits the entire form in the browser instead of doing a "fit width".  This causes my users to have to fit it to the width in IE manually.  Some of my users have a screen resolution of 1024 x 768 and some have a screen resolution of 800 x 600.  I would like to force a "fit width" when anyone opens the form in IE.  How can I force that?  If this requires programming code I will need specifics.  Thanks!

6 Replies

Avatar

Level 10

Hi,

If you place the following javascript in one of your objects. You are looking for an event that will fire in HTML as well as Acrobat. I would recommend the "initialize" event at this stage.

app.execMenuItem("FitWidth");

I haven't opened files in a browser, so I am not sure if this will work (it works OK in Acrobat).

Good luck,

Niall

Avatar

Level 2

Thanks for the tip. Do I place that in the XML Source? If so, I believe

that I found the lines where I should insert your suggested code, but I am

not sure exactly how to insert the code into:

/*

Avatar

Level 10

Hi,

No; I would not recommend inserting script directly into the XML Source tab. You rarely have to go in here.

If you go to the Design view and select on of the objects in your form (TextField, numericField, etc). Then check that your Script Editor is open, it should be visible at the top of the window, just below the menu and toolbars. It may only be one line high, if that is the case then drag the bottom bar to make it bigger.

If you cannot see the Script Editor, then you can open in from the Window menu or select Control+Shift+F5.

Parallels DesktopScreenSnapz002.png

When you select an object, you can go to the Script Editor and select from the dropdown which event you want to script for. In this case we are looking for the Initialize event. The script is Javascript so you need to check that in the language dropdown. Also unless you are using a server solution, your scripts will run at Client.

You can put in the script into the Script Editor.

Hope that helps,

Niall

Avatar

Level 2

Ok thanks. I have it working now. I found another post that said that I

should try the following:

event.target.zoomType = zoomtype.fitW;

I placed the code above in the docready event and it worked. Thanks for the

advice as it started me down the right path to the solution.

Avatar

Level 10

You don't even need to put the script on an object, you can put it on the form itself - the "form1" object in the hierarchy in Niall's example.