Stefan Cameron on Forms
Building intelligent forms using Adobe LiveCycle Designer

'Acrobat' Category Archive

Auto-splitting text between two text fields

The scenario

You have a compliant form that has sections for users to fill-in information. Because the form is compliant (i.e. its layout has received the “stamp of approval” and cannot change without another lengthy approval process), the sections cannot grow (they cannot expand-to-fit all of the text users may fill-in). To provide more space for users to add more text, you’ve provided an expandable “overflow” section at the end of form since expanding that section will not affect the portion of the form which has been approved.

The problem

You need to capture the text entered into the form using an interactive Form Guide which is not limited to the restrictions of the form’s approved layout. As such, the Form Guide will capture the text in a single field and you need that text to be entered into the PDF version of the form. If you put all the text into the appropriate section on the form, it won’t fit and the text will be cut-off (e.g. it will not print entirely and you will miss some of the important information).

You need some way to automatically split that text between the small section in the form and the overflow section at the end of the form. In other words, you need to ensure that only the text that can fit within the small form section is placed there and the rest is placed in the overflow section at the end.

In Designer 8.2, the content of fields can now be split between pages however in this case, you can’t use this feature because the small form section can’t be expanded (it’s fixed in size).

The solution

This is the problem Stephanie, Glenn and I were faced with on a recent customer visit. Stephanie took the time to put this into a sample form which provides the script we wrote to handle this task. It’s basically a mini text parser written in JavaScript that splits text between two fields with a fixed-width font (e.g. Courier New, Lucida Console, etc.).


Posted by Stefan Cameron on July 10th, 2008
Filed under Acrobat,Designer,Form Guides,Scripting,Tutorials

Acrobat Pro 9 with Designer 8.2 now available!

You can now purchase Acrobat 9 Standard, Pro and Pro Extended. You can also download Reader 9.0. An updated version of Designer (8.2) is included with the Pro and Pro Extended versions.

I’ve been using Designer 8.2 for quite some time now (working at Adobe does have its perks!) and I must say it’s much more stable than 8.1 and has a lot of really nice, new features to offer such as:

  • major tab ordering UI update — we listened to your feedback and made this a whole lot better than it ever was before;
  • hyperlink support;
  • advanced text formatting with kerning, horizontal/vertical stretch, hyphenation, etc;
  • enhancements to the Fragment Library (you can now edit Fragment Info metadata without having to open the fragment and you can also delete fragments right from the Fragment Library);
  • contents of fields (text fields, numeric fields, etc.) and text objects can now be split across pages for a nicer layout;
  • authenticated web service support.

Those are only the highlights. There are many other little but very significant updates that I’ll be sharing in future blog posts so stay tuned and in the mean time, get the free trial and check it out!

Acrobat/Reader 9.0 also has a host of new features including:

  • native support for Flash (you can now embedded SWFs directly into your PDF documents);
  • assemble various files together into a cohesive, branded package called a PDF Portfolio;
  • and many more features that will enhance productivity and collaboration.

As usual, there are enhancements to XFA-PDF forms in Acrobat/Reader and I’ll be highlighting a few of those as well in future posts.

PS: Note that the standalone version of Designer has not been updated yet. I suspect it’ll be updated very soon however at this time, it looks like the only way to get Designer 8.2 is by downloading/purchasing Acrobat 9.0 Pro/Extended.


Posted by Stefan Cameron on July 3rd, 2008
Filed under Acrobat,Designer

Target Version Reference

LC Designer ES (8.1) introduced a new feature called Target Version to help you design forms for use in specific versions of Acrobat/Reader. Although new releases of Designer usually support most new features introduced in new releases of Acrobat, there are still some differences and the Target Version feature will help you ensure that your form isn’t using a feature that isn’t compatible with the version of Acrobat/Reader that you’re targeting (the version you expect the users of your form to use).

You can set a form’s target version by using the “File menu > Form Properties > Defaults > Target Version” property.

For example, the “Lock Fields After Signing” feature of digital signature fields is not supported in versions of Acrobat/Reader less than 8.0. By setting your form’s target version to “Acrobat/Reader 7.0.5 or later”, Designer would issue a warning (in the Warnings palette) about this fact if you placed a digital signature field on your form and checked the “Object palette > Document Signature > Lock Fields after Signing” box.

The Target Version Reference document (under the “Develop” tab) details the versions of Acrobat/Reader that are compatible with Designer features from version 6.0 to 8.1, incl. This should help you ensure that your forms are always compatible with the versions of Acrobat/Reader you expect your target audience to use.


Posted by Stefan Cameron on April 18th, 2008
Filed under Acrobat,Debugging,Designer

Prevent Printing PDF Forms in Acrobat 8

This is something many of you have asked me about in the past and I never had a definite answer. The only method I knew of was to use a print button from the Object Library palette and add some checks for invalid data (or unfilled fields) inside its click event which is set to call xfa.host.print() by default. The problem with this method is that the user could still print using Acrobat’s print command (either via “File > Print”, the print button in the toolbar or by using “Ctrl + P”).

I didn’t know any better because, well, prior to Acrobat 8, there wasn’t really anything better and the reason was that form validations simply weren’t triggered prior to Acrobat receiving the command to print. So while you could easily prevent a form from being submitted electronically if validations failed, there was no definitive way to prevent it from being printed… until Acrobat 8 and XFA 2.5 came along, that is.

Advanced Tutorial: Before you read further, I should warn you that this is an advanced tutorial as it (unfortunately) requires editing the “XML Source” using Designer since Designer doesn’t have settings for this yet.

New Validate element in the Config DOM

In version 2.5, the Present element in XFA’s Configuration Document Object Model (“Config DOM” for short), which houses configuration options for XFA applications (such as Acrobat and Reader), was extended to have a Validate element.

This element can have any of four optional values, each separated by a space: “prePrint“, “preSubmit”, “preSave” and “preExecute”. By default, the element is not specified and the default behaviour (which is the same when the element is specified but contains no values) is to validate prior to submitting the form only. Once values are specified, then validations are run only prior to the specified events.

For example, if you wanted to have a form that prevents the user from printing but not submitting when a mandatory field is empty, you would specify the following validate element in the Config DOM (the ellipsis mean there’s other stuff in there; what’s important is the validate element inside the present element):

<config>
   ...
   <present>
      ...
      <validate>prePrint</validate>
      ...
   </present>
   ...
</config>

Unfortunately, this isn’t something that you can reliably set via script since these options are typically read-in on load and aren’t read again. Furthermore, Designer does not yet support setting the values in the validate element. In order to set this option, you’ll need to edit the XML Source in Designer and find the following markup about 2/3 way down:

<config xmlns="http://www.xfa.org/schema/xci/1.0/">
   <agent name="designer">
      ...
   </agent>
   <present>
      <!--  [0..n]  -->
      ...

Once you’ve located the <present> element inside the <config> element (the Config DOM), you’ll need to insert the <validate> element:

<config xmlns="http://www.xfa.org/schema/xci/1.0/">
   <agent name="designer">
      ...
   </agent>
   <present>
      <!--  [0..n]  -->
      <validate>prePrint</validate>
      ...

(Notice the <validate>prePrint</validate> element above.)

When you’re done making the change, click on the Design View tab and make sure you say “yes” to have your changes applied.

XFA 2.8/Acrobat 9 Update: With the release of XFA 2.8 and Acrobat/Reader 9.0, the <validate> element is now located under the <acrobat> element in the Config DOM:

<config>
   ...
   <acrobat>
      ...
      <validate>prePrint</validate>
      ...
   </acrobat>
   ...
</config>

To ensure backward compatibility, if the <validate> element is not found under <acrobat>, Acrobat/Reader will fall back to looking inside the old <present> to see if it’s defined there.

Now you’re probably wondering what the different values mean so here’s a quick explanation:

  • prePrint: Failed validations prevent the form from printing.
  • preSubmit: Failed validations prevent the form from being submitted electronically.
  • preSave: Failed validations will not prevent the form from being saved however Acrobat/Reader will issue a special warning message, after issuing the validation error message, to inform the user that the validations failed. I’m guessing this is because the user may be saving the form to continue filling it at a later time so the save can’t be completely prevented.
  • preExecute: Failed validations will prevent the form from executing a data connection (usually to a web service).

In all cases, any validation error messages will be displayed and this should work in Reader 8 as well. If you have set validation warnings (as opposed to errors), then the warnings will be displayed but the user’s action will not be stopped.

Sample Form

I took the time to put together a little sample form which demonstrates a Dynamic PDF form that cannot be printed nor submitted in Acrobat/Reader 8 and above unless the text field is filled.

Download Sample [pdf]

Minimum Requirements: Acrobat/Reader 8 or above.

Updated: December 20, 2008


Posted by Stefan Cameron on April 13th, 2008
Filed under Acrobat,Designer,Tutorials

XFA 2.6 Spec Now Available

I was just looking at the Adobe XML Forms Architecture (XFA) web page and noticed that the XFA 2.6 spec was posted recently (near the end of January 2008, I think). I have to admit I didn’t expect to see it there for a while still but this is a good thing!

XFA 2.6 is supported by LiveCycle Designer 8.1 and Acrobat/Reader 8.1.


Posted by Stefan Cameron on March 5th, 2008
Filed under Acrobat,Designer,XFA