<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Assure HSC &#124; Blog &#187; Cookbooks</title>
	<atom:link href="http://assurehsc.ie/blog/index.php/category/livecycle/cookbooks/feed" rel="self" type="application/rss+xml" />
	<link>http://assurehsc.ie/blog</link>
	<description>Technology and Safety</description>
	<lastBuildDate>Tue, 23 Nov 2010 20:34:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How often events fire and their sequence</title>
		<link>http://assurehsc.ie/blog/index.php/2010/05/how-often-events-fire-and-their-sequence/</link>
		<comments>http://assurehsc.ie/blog/index.php/2010/05/how-often-events-fire-and-their-sequence/#comments</comments>
		<pubDate>Sun, 30 May 2010 00:21:21 +0000</pubDate>
		<dc:creator>Niall O'Donovan</dc:creator>
				<category><![CDATA[Cookbooks]]></category>
		<category><![CDATA[LC Designer]]></category>
		<category><![CDATA[linkedin]]></category>

		<guid isPermaLink="false">http://assurehsc.ie/blog/?p=47</guid>
		<description><![CDATA[This is a good study of LC Designer events. It highlights the sequence of events and how often some events fire. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fhow-often-events-fire-and-their-sequence%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fhow-often-events-fire-and-their-sequence%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Some events fire more often than others. Depending on what the designer is trying to achieve, this can be inefficient and may not have the desired effect at runtime. Another issue is the sequence in which events fire. A designer may have a requirement for several scripts to fire in a certain sequence. Having an understanding of how LC Designer and Acrobat fire events can help at design time.<span id="more-47"></span></p>
<p>I original had the idea of having a form that set out the pros and cons of each event and giving examples of script that could be used in each event. In the end, it has focused on the number of times that different events fire and the sequence. To view this form you will need Acrobat/Reader version 9 or above. This is because it contains script against the preOpen and postOpen events. Also it used setItems to populate the listbox.</p>
<p>The attached form has a lead-in page to introduce the different types of events and how to use the form.</p>
<p>The second page contains the &#8220;test area&#8221;, which is where you can decide which objects you are going to look at, via the dropdown list. There are textfields, numericfields, buttons, subforms, dropdown lists, etc. Some of the objects are standalone, while others are bound together. For example a textfield will have the following in the calculate event:</p>
<pre><em>this.rawValue = textField2.rawValue;</em></pre>
<p>Below the test area are counters for the three types of events (Process; Interactive; and Application). These show how often each event fires.</p>
<p>You can show and hide the different types of events, for example if you want to focus on a particular group.</p>
<p>Even though there are other objects in the form, only those in the test area are counted, as events fire.</p>
<p>All of the objects in the test area have scripts in each event. Generally these script are triggering the counters; however a couple are also binding objects together. This is useful in demonstrating the firing of calculate and validate events for objects that are bound.</p>
<p>There is a log showing the sequence in which the events have fired. When you go into the test area the log with automatically hide. Clicking the show button will make it visible again. Note that clicking the hide button will also clear the log.</p>
<p>There were quite a few challenges in developing this:</p>
<ul>
<li>The calculate; validate; and layout:ready events were bound by the counters. So it took several attempts to separate out the calculate and validate events from the counters, so that they did not run away with themselves.  In the end we broadcast the counter value out and the objects are not linked;</li>
<li>Getting the log to record the events as they fired and have the most recent events visible at the bottom of the log. We used the new setItems script to populate the listbox with a global variable.</li>
</ul>
<p>The form has some &#8220;interesting&#8221; script, but not much that has purpose in a real world form.</p>
<p>It is more of a point of interest to look at the interaction of events and how often some events like layout:ready fire.</p>
<p>The sample form is available <a title="Click here to open the form in Acrobat/Reader..." href="http://assurehsc.ie/blog/wp-content/uploads/2010/05/2009-11-17-LiveCycle-Designer-Script-Events.pdf" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://assurehsc.ie/blog/index.php/2010/05/how-often-events-fire-and-their-sequence/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Moving objects around a form</title>
		<link>http://assurehsc.ie/blog/index.php/2010/05/moving-objects-around-a-form/</link>
		<comments>http://assurehsc.ie/blog/index.php/2010/05/moving-objects-around-a-form/#comments</comments>
		<pubDate>Sun, 30 May 2010 00:10:59 +0000</pubDate>
		<dc:creator>Niall O'Donovan</dc:creator>
				<category><![CDATA[Cookbooks]]></category>
		<category><![CDATA[LC Designer]]></category>

		<guid isPermaLink="false">http://assurehsc.ie/blog/?p=41</guid>
		<description><![CDATA[This sample just shows some of the potential in accessing the current mouse position. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fmoving-objects-around-a-form%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fmoving-objects-around-a-form%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Allowing a user to move objects (in this case buttons) around the form. We wanted the user to be able position markers within a grid. The number (caption) of the button related to a particular solution in a table.<span id="more-41"></span></p>
<p>This solution is based on the &#8220;fly swatter&#8221; example by Thom Parker (http://www.pdfscripting.com) and samples by John Brinkman (http://blogs.adobe.com/formfeed/) looking at x, y, w and h properties.</p>
<p>The attached form contains three examples where buttons can be moved within set constraints.</p>
<ul>
<li>The first example has three sliders for setting red, green, blue values for an image.</li>
<li>The second example uses a single slider to change the size of an image.</li>
<li>The third has a series of markers which can be placed within a grid.</li>
</ul>
<p>The basic approach is to set the x,y coordinates of the object based on the current mouse position.</p>
<p>You will notice that all three examples are in subforms which are located at 0,0 on the page. This is necessary so that the coordinates of the mouse will match the coordinates of the objects in the subform. If the subform was positioned down and to the right, then the script would need an offset constant.</p>
<p>The main script is in the exit event of the buttons. The first step is to establish the dimensions and position of the rectangle in which you will allow the buttons to move.</p>
<pre><em>var gridX = xfa.layout.x(gridPICK);
var gridY = xfa.layout.y(gridPICK);
var gridW = xfa.layout.w(gridPICK);
var gridH = xfa.layout.h(gridPICK);</em></pre>
<p>The next step is to get the dimensions of the button/marker:</p>
<pre><em>var markerDim = xfa.layout.w(marker1) / 2;</em></pre>
<p>We can then set variables for the x,y coordinates of the mouse position and for the new coordinates of the object.</p>
<pre><em>var mouseX = event.target.mouseX;
var newX = (mouseX + "points").toString();
var mouseY = 595.276 - event.target.mouseY;
var newY = (mouseY + "points").toString();</em></pre>
<p>The only step left is to determine of the x,y coordinates are within the rectangle or outside the rectangle. If the mouse is outside the rectangle then the coordinates are set to the rectangle boundaries.</p>
<pre><em>if (mouseX &lt;= gridX + markerDim)
{
   this.x = (gridX + markerDim + "points").toString();
}
else if (mouseX &gt;= gridX + gridW - markerDim)
{
   this.x = (gridX + gridW - markerDim + "points").toString();
}
else
{
   this.x = newX;
}</em></pre>
<p>The first two examples only move the buttons along the x-axis. Whereas the third example moves objects horizontally and vertically.</p>
<p>Because the script is in the exit event of the buttons, then movement is not in real time and requires the user to click twice. Once to activate the button and the second to position the button in a new position.</p>
<p>Not as smooth as other Flash/Flex solutions, but as best as I could achieve in LiveCycle Designer.</p>
<p>Suggested improvements are welcomed.</p>
<p>Sample form is available <a title="Click here to open the form in Acrobat/Reader..." href="http://assurehsc.ie/blog/wp-content/uploads/2010/05/2009-11-15-Moving-objects.pdf" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://assurehsc.ie/blog/index.php/2010/05/moving-objects-around-a-form/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using LiveCycle forms in Acrobat and Reader</title>
		<link>http://assurehsc.ie/blog/index.php/2010/05/using-livecycle-forms-in-acrobat-and-reader/</link>
		<comments>http://assurehsc.ie/blog/index.php/2010/05/using-livecycle-forms-in-acrobat-and-reader/#comments</comments>
		<pubDate>Sat, 29 May 2010 22:21:07 +0000</pubDate>
		<dc:creator>Niall O'Donovan</dc:creator>
				<category><![CDATA[Cookbooks]]></category>
		<category><![CDATA[LC Designer]]></category>
		<category><![CDATA[Reader Extensions]]></category>

		<guid isPermaLink="false">http://assurehsc.ie/blog/?p=29</guid>
		<description><![CDATA[After you develop a form in LiveCycle, the users can have very different experiences with the form depending on the software they are using and if / how the form has been Reader Enabled. The various options that are available or disabled can be confusing. This PDF sets out the four options that a developer should consider before you deploy the form. In essence you are looking at the user and the likelihood that they only have Reader and not the full Acrobat. If this is the case then they may not be able to use all of the features that you built into the form. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fusing-livecycle-forms-in-acrobat-and-reader%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fusing-livecycle-forms-in-acrobat-and-reader%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Sometimes a person will develop a form and test it on their PC with Acrobat. When they are happy with the look, feel and functionality they will send it out to users. If the users have Reader then some of the functionality may not be available, leading to frustration.<span id="more-29"></span></p>
<p>LiveCycle Designer ES has a handy feature where the developer can set the target version of Acrobat/Reader and then check the warnings tab to verify that the form will work in that target version. However this does not take into account whether the form will be Reader Enabled.</p>
<p>The attached PDF does not present new information, merely gathers information on enabled features and restrictions together in one location. The information focuses on users who have the free Adobe Reader.</p>
<p>As I see it there are four possible options when deploying a form. The first considers when the users have Acrobat and the other three deal with Reader:</p>
<ul>
<li>All of the users will have Acrobat, so that the form does not need to be Reader Enabled. In this case there are no restrictions and the users will have full functionality;</li>
</ul>
<ul>
<li>Where users have Reader and the form has not been Reader Enabled. This is the most restricted;</li>
</ul>
<ul>
<li>When the form is Reader Enabled in Acrobat, users with Reader can save the form but they are still some features that are restricted. Note that certain licence restrictions apply;</li>
</ul>
<ul>
<li>The last option considers the form being Reader Enabled using LiveCycle Reader Extensions ES (or ES2). The degree of functionality will depend on the options selected by the developer during the process.</li>
</ul>
<p>The sample outlines what users will be able to do and what restrictions apply depending on how the form is deployed.</p>
<p>This example does not contain any script, its just a reference document. It was created using InDesign and exported to PDF. Buttons were added to provide the rollover examples.</p>
<p>The summary is available <a title="Click here to open the summary in Acrobat/Reader..." href="http://assurehsc.ie/blog/wp-content/uploads/2010/05/2009-10-14-LiveCycle-Forms-in-Acrobat-and-Reader.pdf" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://assurehsc.ie/blog/index.php/2010/05/using-livecycle-forms-in-acrobat-and-reader/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Script to access Acrobat menu items</title>
		<link>http://assurehsc.ie/blog/index.php/2010/05/script-to-access-acrobat-menu-items/</link>
		<comments>http://assurehsc.ie/blog/index.php/2010/05/script-to-access-acrobat-menu-items/#comments</comments>
		<pubDate>Sat, 29 May 2010 22:08:51 +0000</pubDate>
		<dc:creator>Niall O'Donovan</dc:creator>
				<category><![CDATA[Cookbooks]]></category>
		<category><![CDATA[AcroForm]]></category>
		<category><![CDATA[LC Designer]]></category>
		<category><![CDATA[XFA]]></category>

		<guid isPermaLink="false">http://assurehsc.ie/blog/?p=18</guid>
		<description><![CDATA[I had been trying to access Acrobat menu commands from within an XFA form. Some of these are readably available, however the problem remained however as the command I wanted to access was restricted for security reasons. There are a wide range of scripts that can be used to access menu items in Acrobat. However some [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fscript-to-access-acrobat-menu-items%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fassurehsc.ie%2Fblog%2Findex.php%2F2010%2F05%2Fscript-to-access-acrobat-menu-items%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I had been trying to access Acrobat menu commands from within an XFA form. Some of these are readably available, however the problem remained however as the command I wanted to access was restricted for security reasons.<span id="more-18"></span></p>
<p>There are a wide range of scripts that can be used to access menu items in Acrobat. However some of these are blocked for security reasons. There are a range of menu items that are still accessible; however the syntax is not always clear.  This PDF (XFA form) provides the script for the Acrobat menu items that are currently permitted. It also has XFA equivalents and Acrobat JavaScript equivalents, where these are available. The form is set up so that you can access the scripts by clicking the buttons. The scripts appear in a dialogue and can be copied directly into LiveCycle Designer.</p>
<p>Still, armed with the list of commands I prepared a form in which to test each of the commands and create a library of commands that worked.</p>
<p>I have loosely grouped the scripts by function. You can preview the script by clicking the button. This allows you easy access to the script without having to open the form in LC Designer:</p>
<div id="attachment_19" class="wp-caption alignnone" style="width: 310px"><a href="http://assurehsc.ie/blog/wp-content/uploads/2010/05/AcrobatScreenSnapz005.png"><img class="size-medium wp-image-19" title="AcrobatScreenSnapz005" src="http://assurehsc.ie/blog/wp-content/uploads/2010/05/AcrobatScreenSnapz005-300x231.png" alt="acrobatmenuitems" width="300" height="231" /></a><p class="wp-caption-text">Accessing Acrobat menu items</p></div>
<p>The user can copy the script direct from the dialogue window.</p>
<p>Where there is an XFA equivalent, I have provided this as an option:</p>
<div id="attachment_20" class="wp-caption alignnone" style="width: 310px"><a href="http://assurehsc.ie/blog/wp-content/uploads/2010/05/AcrobatScreenSnapz006.png"><img class="size-medium wp-image-20" title="AcrobatScreenSnapz006" src="http://assurehsc.ie/blog/wp-content/uploads/2010/05/AcrobatScreenSnapz006-300x297.png" alt="XFA equivalent script" width="300" height="297" /></a><p class="wp-caption-text">Alternative scripts are available</p></div>
<p>Lastly, where a function can be accessed via a menu item and via Acrobat JavaScript I have included this as well:</p>
<div id="attachment_21" class="wp-caption alignnone" style="width: 310px"><a href="http://assurehsc.ie/blog/wp-content/uploads/2010/05/AcrobatScreenSnapz007.png"><img class="size-medium wp-image-21" title="AcrobatScreenSnapz007" src="http://assurehsc.ie/blog/wp-content/uploads/2010/05/AcrobatScreenSnapz007-300x297.png" alt="Acroform equivalent" width="300" height="297" /></a><p class="wp-caption-text">Acroform commands</p></div>
<p>At this stage I am reasonable happy that the list of scripts accessing menu items is complete (currently not restricted). In relation to XFA equivalents and Acrobat JavaScript equivalents, there may be some that I have missed.</p>
<p>This mini-project started out with the aim of having a list of Acrobat menu items that could be accessed in LC Designer. Clearly there is a wide range of other Acrobat functionality that is not associated with a menu that can be accessed via JavaScript. These are not cataloged here.</p>
<p>Here I am providing an updated version of the form. This version has not being signed, so functions like attaching a file now work.</p>
<p>The sample form is available <a title="Click here to open the form..." href="http://assurehsc.ie/blog/wp-content/uploads/2010/05/2009-11-25-PDF-Menu-Items.pdf" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://assurehsc.ie/blog/index.php/2010/05/script-to-access-acrobat-menu-items/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
