Section 508 Compliance – Expert Advice

This post is the start of a new series concerning Section 508 compliance remediation. Our expert 508 compliance team has encountered several workflow errors while using Acrobat for 508 remediation.  These errors cause some serious headaches for both users and clients. As such, we felt it would be useful to cover some of these issues here, along with advice on how to overcome them.

Experience with Section 508 Compliance

Graphic for section 508 compliance

Being compliant with Section 508 does not necessarily mean that the document is completely accessible. Our team has been working to achieve both compliance and accessibility for over five years. We boast 100% USA citizen employment for guaranteed quality, and do not outsource our labor. The issues that we will be discussing in further posts are ones that have come up while working, and which we have been able to resolve.

PDF Experts

XI-Standard in Box

The Word Wizards team has been working with Acrobat for our Section 508 compliance since version 8. When an issue with Acrobat arises, we have worked directly with Adobe in order to solve it. As such, we’ve developed a reputation for being able to resolve some of the most difficult problems with PDF documents. If you come across a problem of your own that we haven’t covered, let us know in the comments! We will be more than happy to answer your questions.




Software Upgrade – Adobe Acrobat XI: Product Review

It works, finally!

When Acrobat Pro X was released, we bought it without a second thought. Acrobat Pro 9 was such a nice improvement over Pro 8 we thought X would bring even further refinement of Acrobat Pro’s features, and hoped that the accessibility components, in particular, would be improved. We were disappointed on both fronts.

On the accessibility side, Acrobat Pro X arrived fundamentally broken and couldn’t be used effectively.

Acrobat X Pro

Features the art department needs (basically, an easy way to re-save a PDF so that clients can use Adobe Reader’s commenting features) were moved from the now-removed Advanced menu into the File menu and buried into a sub-submenu, turning what was once a simple task into something onerous. And to add insult to injury, viewing a comment list became even slower and checkbox filtering just didn’t work. We banished this defective software from our hard drives and went back to using Acrobat Pro 9.

The Bad News

Enter Acrobat Pro XI. Given how unfortunate Pro X’s release was, we were at once skeptical, but hopeful, that Adobe had fixed it. Our skepticism was not helped by the fact that Adobe insists users allow them and various unnamed companies with whom they say they work to send us commercial emails as a condition of downloading the trial version. Basically, that means if we end up buying the software, we’ve paid Adobe to spam us. Cute

The Good News

Once we resigned ourselves to the idea that we are going to have to re-train our junk mail filters to weed out all those additional emails we won’t want, we got down to the business of evaluating the software. Which was in fact pretty good.

Accessibility is its own complicated topic, and requires more space than we can give it here. Pro XI looks like it has some editing features that will make it less painful to make simple corrections to a file, something the accessibility people here are often faced with, as clients often ask for small changes before we tag their PDFs.

XI-Standard in Box

But we were thrilled to learn that the production-flow features the art department uses have been revisited and fixed, and now work great. While the Enable Commenting feature is still buried two levels deep in the File menu, Adobe has provided a convenient way to access it via a custom toolbar icon we were able to find pretty easily. It’s now slightly easier to save out a comment-enabled PDF than it was in Acrobat Pro 9.

Acrobat XI is here!

We also like the comment list layout—introduced in Pro X—to the side rather than on the bottom. On a Cinema Display monitor, this layout approach makes a lot of sense and it’s much easier to navigate down the list and make corrections to a document now. Nice that checkbox filtering works with this release, too.

Pulling the Trigger

Still, is it worth the price of an upgrade? If we’re talking about a print-production workflow, probably not. It’s nice and all, but Acrobat Pro 9 still does everything the art department needs it to do, although the comment list layout tempts us. But since Adobe increased its upgrade pricing by fifty dollars to $199 a couple of years back, the whole upgrade carousel thing gives us pause. (We’re also not too enamored with the so-called Creative Cloud subscription software scheme Adobe would love us to adopt, but that’s another article altogether.)

Upgrade or fall behind (silly meme)

To tip the scale in favor of the upgrade, our accessibility people will have to let us know what they think of the software. But given the new PDF editing features, my guess is we’ll be upgrading soon.

Make sure to sign up for our newsletter if you liked this article, we will be providing an in dept section 508 accessibility review of Acrobat XI in the near future!




Find a Fieldname Prefix on Acroform Pages with JavaScript

When spawning new pages in an Acrobat Acroform, you can choose to rename, or not rename, all the fields on the new page. Obviously, if you don’t rename your field names, you know what the field names on the new pages will be.

But what if your user really needs a lot of continuation pages? Let’s say your user needs to be able to spawn an indefinite (infinite) number of the same continuation page. In that case, you will need each field on each continuation page to have a unique name. If you didn’t rename the fields, and you spawned multiples of the same page, you would have duplicate field names, thus duplicate data on all your continuation pages.

Just to make it interesting, let’s also say that you have several different templates from which to spawn pages. And let’s say that the users are able to add continuation pages in any order they like. How would you be able to address field names on all these new continuation pages?

The Fieldname Prefix Format

When you choose to rename fields on spawned template pages, using the bRename parameter, Acrobat will rename the fields by prefacing every field on the page with the page number and the template name. The format is:

P4.MyTemplateName.myFieldname

P4 is the zero-based number of the page which was added.
MyTemplateName is the literal value of the template names.
myFieldname is the fieldname that you assigned originally.

So for example, the field on a template named Template1, generated on page 4 of the form, and originally named myFieldname, would become:

P3.Template1.myFieldName

How to find the prefix for a page

In the example above, you can end up with a ton of spawned pages from several different templates in a random order. If you want to loop through all your pages extracting information for your database, how could you do it?

All fields on a spawned page share the same prefix. All we need is to be able to find the prefix of each page. To find this prefix, I have written the following functions:

GetPrefix(currentPageNum)
IsContinuationField(currentFieldName)

GetPrefix( )

When you use the GetPrefix() function, you pass a page number value. Most likely, but not always, you will want to pass the value of the current page, and will use the predefined variable pageNum. GetPrefix loops through a list of all the fields in the document, looking for the first occurrence of any field which is prefaced with “P” plus the requested page number. When it finds the first occurrence of the requested number, it returns the prefix. Here is the code:

//  Get the prefix of a specific number continuation page. The page number is in the first segment of
//  all the renamed field names, in the format P#, where # is the number of the page in question.

function GetPrefix(currentPageNum) {
 	//  Go through the list of all the fields in this document.
	for (var i = 0 ; i < this.numFields ; i++) {
	//  Get the Nth field name from the list of all field names on the form.
		var cFieldName = this.getNthFieldName(i);
		//  Test to see if this field is from a continuation page.
		//  See the explanation of IsContinuationField() function.
		var foundOne = IsContinuationField(cFieldName);
		//  If it is from a continuation page, return the prefix. 
		if (foundOne) {
			//  Create an array of the field name components:  
			//		0 => P# for page number
			//		1 => T# for template name (number)
			//		2 => the original field name
			var aFoundOne = foundOne.split(".");
			//  Get the number after "P", could be more than single digit.
			var numberComponent = aFoundOne[0].substring(1);   
			if ( numberComponent == currentPageNum ) { 
				return  foundOne ;
			}
		}
	}
}

IsContinuationField( )

GetPrefix() uses a function called InContinuationField(). Since we are only searching for the prefix of pages spawned with the rename parameter, we want to eliminate any field name that doesn’t start with Pn.TemplateName.

The IsContinuationField() checks to see if the field being tested is from a continuation page. By using the String.split method, it isolates the segments of the fieldname. If the fieldname has at least three segments, and the first segment begins with “P”, a continuation page has been found. In this case, it returns a prefix to be tested by GetPrefix().. Here is the code:

//	Determine if a field name came from a spawned template page created using the rename parameter.

function IsContinuationField(currentFieldName) {
	//   For the field passed, determine if it came from a continuation page.  
	//	  	If Yes, return the field prefix
	//		If No, return false.
	var cFieldName = currentFieldName;
	// convert the full field name to an array
	var aFieldName = cFieldName.split(".");

	if (aFieldName.length > 2) {
   // element 0 of the field name array is P#
   // element 1 of the field name is the template that created the page
   // element 2 is the rest of the field name, as it exists in the template page.

   		var firstLetter = aFieldName[0].substring(0,1);
		//  If the first letter of the first segment of the field name is a P, return the prefix.
   		if ( firstLetter == "P" ) {			
   			var foundFieldPrefix = aFieldName[0] + "." + aFieldName[1] + ".";
			//app.alert("The field prefix is " + foundFieldPrefix);
			return foundFieldPrefix;
		}
		else  {
			return false;
		}
	}
}

Some Other Helpful Code

RenumberPage( )

Here is an example of the use of GetPrefix() and IsContinuationField(). In RenumberPage(), the page total on all the continuation pages is updated after a new page is spawned.

//   Renumber pages and page totals after a page has been added.
function RenumberPages()  {

	//   Adjust the totals on the first three pages, which are static.
	this.getField("txtPageTotal1").value = numPages;
	this.getField("txtPageTotal2").value = numPages;
	this.getField("txtPageTotal3").value = numPages;	
	//   Then update the page totals on any continuation pages. 
	//   The pages are zero-based. NumPages is 1 based. So start with Page 4, which is number 3.	
 	for (var i=3 ; i <  numPages ; i++)  {   		
		var myPrefix = GetPrefix(i);
		//  Create an array of the field name components:  
			//		0 => P# for page number
			//		1 => T# for template name (number)
			//		2 => the db_xxxxx field name
		if (myPrefix)  {
			var aPrefixSegments 	= myPrefix.split(".");
			//	Isolate the Template Name
			var templateName 		= aPrefixSegments[1];
			//   The two fields,the total number of pages and the current page number, 
			//   have the template name appended.
			var myPageNumName 		= (myPrefix + "txtCurrentPageNum" + templateName);
			var myTotalField 		= (myPrefix + "txtPageTotalContinuation" + templateName);
			//  Correcting page number to be 1 based.			
			this.getField(myPageNumName).value = i + 1; 
			//   Assign the current total number of pages.  
			this.getField(myTotalField).value = numPages;
		}
	}	 
}

Using the Prefix in the Fieldname

Once you have the prefix, it is easy to then address the fields on the form using the format:

Var myCompleteFieldName  =  this.getField(GetPrefix(pageNum) + "myTemplateFieldname");

AddPage( )

Finally, here is the code to spawn the template page, using bRename (the field renaming parameter). After the page is spawned, all page number totals are renumbered.

//   Add a Continuation page.
// 	
//
function AddPage(mPage) 
{
	//   mPage is either template name of the template to be added 
	//   nPage - add this page to end of document 
	//   bRename - all fields on that page will be prefaced with:
	//		("P" + newPageNumberBase_0 + . + template name + . ) 
	//	bOverlay - don't overwrite an existing page.

   	var contPage = this.getTemplate(mPage);
 		 contPage.spawn( {
    	 nPage:this.numPages,
     	 bRename:true,
     	 bOverlay:false
	 });		 
	 //  After adding the page, renumber all the pages and their totals.	 
	 RenumberPages();	 
}