Archive for December, 2007

Acrobat Reader Extensions

Friday, December 28th, 2007

The following is an explanation of how to programmatically enable Acrobat Reader Extensions from ColdFusion.

‘Reader Extensions’ is a great enabler for pdf technologies. It allows form filling and annotation on a pdf document for users who only have the free Acrobat Reader. It is useful for general Internet applications, where Acrobat Reader is the norm. We will soon be using it on the Land Rover G4 Challenge, where we need an application form that is the same on the web and when printed.

Another useful scenario is when engaging with large corporates, where Acrobat reader is likely to be part of their standard PC build, and where the time and business cost of getting Acrobat Professional installed for a small number of users in the organisation, can be prohibitive. This is a common scenario with some of our larger clients. Reader Extensions allows us to use Acrobat annotations when approving artwork, catalogs, DM packs etc, without all our users having to install full Acrobat.

Acrobat Professional 8 allows you to enable reader extensions on a PDF for free. There are some limitations which are in the Acrobat EULA and discussed here. If you envisage usage beyond the EULA, have a large number of documents, or need to enable the extensions programmatically then you will need the Reader Extensions service in Adobe LiveCycle.

To anyone unfamiliar with LiveCycle, think of it as a suite of pdf related tools, linked together within a workflow management system, that allows non programmers to define complex workflow interactions. Its a powerful system, designed (and priced) for use by large corporates. Its sold as a modular system, so you can buy just the Reader Extensions part.

There is an article by Allen Levine on the Adobe site on how to enable reader extensions using ColdFusion. Adobe has since released LiveCycle ES, which has improved the integration of the LiveCycle components and provided a web service that can be called without the need for any additional installs or changes to the standard installation. Additionally ColdFusion 8 has made it easier to call and debug web services.

The LiveCycle web service can accept Dime, Mime or Base64 encoded files. The example below uses Base64.

<CFSCRIPT>   

// Define username/password.
// Change to match your installation
creds = structnew();
  creds ['username']='administrator';
  creds ['password']='password';   

// Create web service
wsdl = "http://127.0.0.1/readerExtensions.wsdl";
readerExtensions = createObject("webservice", wsdl, creds);   

// Encode pdf
pdfBase64 = tobinary(ToBase64(ipFile.toByteArray(),
  "iso-8859-1"));   

// Create the structs needed for the web serivce
inPDFDoc = structNew();
  inPDFDoc['contentType'] = "application/pdf";
  inPDFDoc['attachmentID'] = javacast('null','');
  inPDFDoc['remoteURL'] = javacast('null','');
  inPDFDoc['binaryData'] = pdfBase64;   

usageRights = structNew();
  usageRights['enabledComments'] = TRUE|FALSE;
  usageRights['enabledCommentsOnline'] = TRUE|FALSE;
  etc   

applyOptions = structNew();
  applyOptions['message'] = "";
  applyOptions['modeFinal'] = TRUE;
  applyOptions['usageRights'] = usageRights;   

applyUsageRightsRequest = structNew();
  applyUsageRightsRequest['inPDFDoc'] = inPDFDoc;
  applyUsageRightsRequest['credentialAlias'] = credAlias;
  applyUsageRightsRequest['credentialPassword'] = credPassword;
  applyUsageRightsRequest['applyOptions'] = applyOptions;   

// Call web service
applyUsageRightsResponse = readerExtensions.applyUsageRights
  (inPDFDoc,credentialAlias,credentialPassword, applyOptions);   

// decode blessed pdf
pdfBinary = ToBinary(applyUsageRightsResponse.binaryData);   

</CFSCRIPT>

When you install LiveCycle Reader Extensions you will get a certificate from Adobe. You define the credentialAlias and credentialPassword values when installing the certificate.

The only tricky part is providing structures of the correct format to the web service. There are a couple of useful flags to help track down any ambiguities or problems with the wsdl:

creds ['saveJava']=TRUE;
creds ['refreshWSDL']=TRUE;

Add these to the creds struct in the example above, These ensure you have the latest wsdl and also instructs ColdFusion to save the intermediate java files that it creates. These will contain the class definitions which map to the above ColdFusion structures.

Enabling Acrobat Shared Review using ColdFusion

Monday, December 17th, 2007

The PDF annotations in Acrobat are impressive, but the implementation was much more suited to an Intranet rather than an Internet environment. In Acrobat 8, Adobe introduced a new type of online annotation for PDFs, called a ‘Shared Review’. In a shared review the information for configuring the annotation store is on the PDF itself, which makes it much more flexible and robust than previously.

Shared Reviews are normally initialed by a user from within Acrobat. The user follows a wizard, which adds some JavaScript to the PDF. To enable a Shared Review programmatically, needs a suitable library.

ColdFusion8 has a lot of new PDF related functionality provided by the new <cfpdf> tags. Adding JavaScript isn’t one of them. JavaScript can be added, however, by using the iText library, which is included in ColdFusion, presumably to help implement the CFDocument functionality.

The JavaScript that you need to insert into the PDF can be copiedĀ  from an existing PDF made using the manual approach, and then tweaked to suit your requirements.

Here is a snipped showing how to insert the JavaScript using the iText PdfStamper class.

<CFSCRIPT> 
    reader = CreateObject("java", "com.lowagie.text.pdf.PdfReader") 
	.init(expandPath("#ipFName#"); 
    opFile = CreateObject("java", "java.io.FileOutputStream") 
	.init(expandPath("#opFName#")); 
    stamper =CreateObject("java", "com.lowagie.text.pdf.PdfStamper") 
	.init(reader,opFile); 
    stamper.addJavascript(#jscript#); 
    stamper.close(); 
</CFSCRIPT>

Tag: invited to speak at ‘Scotch on the Rocks 2008′

Wednesday, December 12th, 2007

Tag: has been invited to speak at Scotch on the Rocks, a large developer conference for ColdFusion related technolgies. This will be a great opportunity for us to share what we have been doing in ColdFusion and Flex.

Both Simon Gladman and myself will be speaking. You can see us on the Scotch on the Rocks web site: Simon Gladman, David Rutter

One of my tasks as CTO is to help raise the profile of Tag: and its technical expertise.
We have been active in ColdFusion for many years, and have two very experienced ColdFusion development teams: one in London and one in Cape Town. This is the first time we have been invited to participate in a large developer event. Hope to see you there.

New Asset Storage System

Tuesday, December 11th, 2007

This morning we completed the migration of all of our web applications to a new modular storage cluster from Isilon.

Our storage needs for assets have been increasing exponentially. We have upgraded our storage capacity three times over three years and gone from direct attached storage (DAS) to a SAN. The cost of upgrading our current SAN had become prohibitive, so we took a fresh look at our long term storage requirements.

  • We store a lot of assets on behalf of our clients,
    the prices we charge our clients have to be competitive.
  • We need very high availability and reliability
  • We need high levels of redundancy in both the hardware and the assets themselves. We keep a copy of the assets at our disaster recovery system and have redundancy within the primary system.
  • The system needs to integrate wel with our backup and archive systems.

We chose an Isilon modular clustered solution, over other SAN and NAS based alternatives because

  • We can add new capacity on the fly with no down time
  • We have complete redundancy with no single point of failure
  • Good performance
  • Competitive price
  • Provides us with new interesting architectural options for our web applications

The installation was very impressive; the boxes were delivered the day after we placed the order, and the engineers installed the main system in less than 3 hours. The installation in our Disaster Recovery facility also went like clockwork.

We are also using Isilon systems for most of our TV production work, where the main driver is IO performance. We have been using an Isilon system for our London TV production for over 12 months. Last week we installed an additional Isilon system, this time in our New York production facility.

Welcome to the Tag: Blog

Monday, December 10th, 2007

Who we are

Tag: is an international design and production agency dedicated to helping clients and agencies create, manage and deliver their brand messages across the world. We bring consistency, efficiency and more than a little flair to complex global campaigns.

What we do

In a world where brand consistency, campaign synchronicity and time to market are key, Tag: enables you to produce and rapidly disseminate your creative ideas across disparate media and markets, ensuring you have the best press ad, web banner, TV commercial, poster, DM pack, leaflet or brochure in the right place at the right time.

Why We Blog

We do some great things at Tag: that we would like to share, including

  • Business Achievements
  • Product Announcements
  • Technical Advances