Mastering PDF annotations

About a month ago I was asked about possible solution for the following case:

  1. customer has EDMS based on EMC Documentum
  2. after certain lifecycle state documents become readonly (that means that documentcontent gets signed and not supposed to be changed anymore)
  3. despite of readonlyness users want to be able to put some comments into content
  4. customer is potentially ready to convert all content into pdf

You may say that PDF annotations is an option for me. Bullshit! I have checked a couple of implementations and found that all implementations are unsuitable for me, primary reasons are:

  1. some of implementations require read-write access to content (actually there is a workaround with extracting PDF annotations upon upload, but this looks very ugly)
  2. some of implementations are nailed down to specific application and, moreover, are intended to work only through browser, which is very inconvenient – this stupid concept perfectly demonstrated in EMC presentation – user’s monitor is capable to display two A4 pages simultaneously but UI is able to display only 1/3 of the page: – worst UI ever

So, I started to study vendor’s (i.e. Adobe) documentation and have found a possible solution: Acrobat® Online Collaboration: Setup and Administration. Unfortunately, Adobe’s document does not state clearly what is required to inject into pdf to make it “onlinereview-capable”, but after some debugging I have found following solution based on iText library:

String id = "randomId";
String baseUrl = "http://docu70dev01/annotations";
Date date = new Date();
StringBuilder javaScript = new StringBuilder();
javaScript.append("(function () {");
        .append("if (app.viewerVersion >= 8 && (!app.viewerType.match(/Reader/) || ");
        .append("requestPermission(permission.annot, permission.create) == permission.granted)) {");
javaScript.append("var msg = {").append("doc: this,");
javaScript.append("initiator: (new String(\"\")),");
javaScript.append("id: (new String(\"").append(id).append("\")),");
javaScript.append("source: (new String(\"").append(baseUrl).append("/")
        .append("driver: (new String(\"urn://\")),");
javaScript.append("invitees: (new String(\"\")),");
javaScript.append("sentDate: (new Date(").append(date.getTime() / 1000)
javaScript.append("deadDate: (new Boolean(false)),");
javaScript.append("requireSave: (new Boolean(false)),");
javaScript.append("cc: (new String(\"\")),");
javaScript.append("distributionMethod: (new String(\"MANUAL\")),");
javaScript.append("versionInfo: (new Number(11)),");
javaScript.append("accessLevel: (new Number(0))");
String file = "G:\\Users\\andrey\\Documents\\test.pdf";
PdfReader reader = new PdfReader(file);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(

And after that Acrobat Reader gets cool functionality:

All what I need now is implement WebDav-server 🙂

3 thoughts on “Mastering PDF annotations

  1. That’s interesting point, but wrong. PAS is dead because it had a dependency on Adobe LC and WDK (there is a weird situation: OpenText acquired IGC with Brava, IBM acquired Daeja, EMC is on vulnerable CTS), the point of the my post is to demonstrate how to implement robust solution without using third-party software.


  2. I’m not completely agree, the dependency to Adobe LC, was only required if you was using Adobe Reader. It was due to a limitation of Adobe Reader who (in the past) does not allow to comment document if they was not signed. And to sign the document there was two way manually sign it using Adobe Acrobat Pro or by using the module Adobe LC for Reader Extension. If your users was already using Adobe Acrobat, it was not necessary to install Adobe LC. I think PAS was stopped because it Adobe Reader behaviors have change between 9 and X.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s