Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How do you programmatically "enable for commenting"?

Avatar

Level 1

I have seen a million forum posts where people want to programmatically enable their pdfs for commenting, and the answer is: use LiveCycle.  We are considering buying LiveCycle for our server JUST for this purpose, since there doesn't seem to be any other way to do it.  Before we do, I want to know how it would work.  Since I don't have livecylce, I can't very well poke around and figure it out, and I don't see any free trial downloads.  Can anyone explain how you would go about this task?  On the other hand, isn't the pdf an open document standard?  Is there any way to modify the pdf "under the hood" to enable it for commenting, without using the Acrobat menu item?

1 Accepted Solution

Avatar

Correct answer by
Level 10

TO programmatically apply uage rights to a PDF document, see the topic named Applying Usage Rights to PDF Documents located at the following URL:

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000411.html

This will explain what to do and will lead you to the following Java code example:

/*
 * This Java Quick Start uses the following JAR files
 * 1. adobe-reader-extensions-client.jar
 * 2. adobe-livecycle-client.jar
 * 3. adobe-usermanager-client.jar
 * 4. adobe-utilities.jar
 * 5. jbossall-client.jar (use a different JAR file if LiveCycle ES is not deployed
 * on JBoss)
 * 
 * These JAR files are located in the following path:
 * <install directory>/Adobe/LiveCycle8/LiveCycle_ES_SDK/client-libs
 * 
 * For complete details about the location of these JAR files, 
 * see "Including LiveCycle ES library files" in Programming
 * with LiveCycle ES
 */
import com.adobe.livecycle.readerextensions.client.*;
import java.util.*;
import java.io.File;
import java.io.FileInputStream;
import com.adobe.idp.Document;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
 
public class ApplyUsageRights{
 
     public static void main(String[] args) {
       try{
                        
            //Set connection properties required to invoke LiveCycle ES                                        
            Properties connectionProps = new Properties();
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);          
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
           
            //Create a ServiceClientFactory object
            ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
            
            //Create a ReaderExtensionsServiceClient object
            ReaderExtensionsServiceClient reClient = new ReaderExtensionsServiceClient(myFactory); 
           
            //Retrieve the PDF document to which to apply usage rights
            FileInputStream fileInputStream = new FileInputStream("C:\\Adobe\\Loan.pdf"); 
            Document inputPDF = new Document(fileInputStream);
                      
            //Create a UsageRight object and specify specific usage rights
            UsageRights useRight = new UsageRights(); 
            useRight.setEnabledDynamicFormFields(true);
            useRight.setEnabledComments(true);
            useRight.setEnabledFormFillIn(true);
            useRight.setEnabledDigitalSignatures(true);
           
            //Create a ReaderExtensionsOptions object
            ReaderExtensionsOptionSpec reOptions = new ReaderExtensionsOptionSpec(); 
                      
            //Set the usage rights 
            reOptions.setUsageRights(useRight); 
            reOptions.setMessage("This is a Rights-Enabled PDF Document");
           
            //Apply usage rights to a PDF document
            Document rightsEnabledPDF = reClient.applyUsageRights(
                 inputPDF,
                 "RE2",
               null,
               reOptions); 
           
            //Create a new PDF file that represents the rights-enabled PDF document
            File resultFile = new File("C:\\Adobe\\Critique5.pdf"); 
            rightsEnabledPDF.copyToFile(resultFile);
                               
          }catch (Exception e) {
                e.printStackTrace();
          }     
     }
}

View solution in original post

17 Replies

Avatar

Level 8

To answer the first part of your post - the trial version can be downloaded from Adobe's web site.  Have a look at:

http://www.adobe.com/devnet/livecycle/trial/

You'll want to take a look at the ReaderExtensions component.  There is a right that product can add to a document to allow commenting.

Avatar

Level 1

Thank you for the link.  At this point, I can't even figure out how to install the trial,  JBOSS?  Websphere?  Huh?  I am just on Windows XP here, trying to evaluate what direction to take this project.  Is there any very simple summary of how you would enable a batch of pdfs for commenting, IF you already had livecycle all set up and installed?

Avatar

Level 10

If you have LiveCycle installed, you have the Reader Extensions service running.

Now when you have a service running in LiveCycle, you can invoke it using several mechanisms. You can use a Java API, Email, Watched folder, Flex, Web service, etc.

You can also build an orchestration (workflow) that calls multiple services.

So it's really up to you as to how you want to invoke Reader Extension.

You can also use the web interface to manually Reader extends the files one by one, or use Acrobat if your form is going to be used by less that 500 users (I believe).

Avatar

Level 1

ok, so do you get an api with LiveCycle that is different than the one you get with Adobe Pro?  Can I automate that procedure by referencing the api in a .Net project?

Avatar

Level 10

"do you get an api with LiveCycle that is different than the one you get with Adobe Pro?"

I don't think you get an public API form Acrobat. You do get an API when using the Reader Extension service in LiveCycle.

"Can I automate that procedure by referencing the api in a .Net project?"

You would most likely use the Web service interface to interact with Reader Extesion.

See  the following links for more details:

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000275.html

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000414.html

Jasmin

Avatar

Correct answer by
Level 10

TO programmatically apply uage rights to a PDF document, see the topic named Applying Usage Rights to PDF Documents located at the following URL:

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000411.html

This will explain what to do and will lead you to the following Java code example:

/*
 * This Java Quick Start uses the following JAR files
 * 1. adobe-reader-extensions-client.jar
 * 2. adobe-livecycle-client.jar
 * 3. adobe-usermanager-client.jar
 * 4. adobe-utilities.jar
 * 5. jbossall-client.jar (use a different JAR file if LiveCycle ES is not deployed
 * on JBoss)
 * 
 * These JAR files are located in the following path:
 * <install directory>/Adobe/LiveCycle8/LiveCycle_ES_SDK/client-libs
 * 
 * For complete details about the location of these JAR files, 
 * see "Including LiveCycle ES library files" in Programming
 * with LiveCycle ES
 */
import com.adobe.livecycle.readerextensions.client.*;
import java.util.*;
import java.io.File;
import java.io.FileInputStream;
import com.adobe.idp.Document;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactory;
import com.adobe.idp.dsc.clientsdk.ServiceClientFactoryProperties;
 
public class ApplyUsageRights{
 
     public static void main(String[] args) {
       try{
                        
            //Set connection properties required to invoke LiveCycle ES                                        
            Properties connectionProps = new Properties();
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);          
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");
            connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "password");
           
            //Create a ServiceClientFactory object
            ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);
            
            //Create a ReaderExtensionsServiceClient object
            ReaderExtensionsServiceClient reClient = new ReaderExtensionsServiceClient(myFactory); 
           
            //Retrieve the PDF document to which to apply usage rights
            FileInputStream fileInputStream = new FileInputStream("C:\\Adobe\\Loan.pdf"); 
            Document inputPDF = new Document(fileInputStream);
                      
            //Create a UsageRight object and specify specific usage rights
            UsageRights useRight = new UsageRights(); 
            useRight.setEnabledDynamicFormFields(true);
            useRight.setEnabledComments(true);
            useRight.setEnabledFormFillIn(true);
            useRight.setEnabledDigitalSignatures(true);
           
            //Create a ReaderExtensionsOptions object
            ReaderExtensionsOptionSpec reOptions = new ReaderExtensionsOptionSpec(); 
                      
            //Set the usage rights 
            reOptions.setUsageRights(useRight); 
            reOptions.setMessage("This is a Rights-Enabled PDF Document");
           
            //Apply usage rights to a PDF document
            Document rightsEnabledPDF = reClient.applyUsageRights(
                 inputPDF,
                 "RE2",
               null,
               reOptions); 
           
            //Create a new PDF file that represents the rights-enabled PDF document
            File resultFile = new File("C:\\Adobe\\Critique5.pdf"); 
            rightsEnabledPDF.copyToFile(resultFile);
                               
          }catch (Exception e) {
                e.printStackTrace();
          }     
     }
}

Avatar

Level 1

Thank you, that is exactly what I wanted to know.

Avatar

Level 1

So, is there really no way to programmatically enable commenting on a PDF without installing the massive LiveCycle server software?  It seems to me a pretty simple thing i can open a PDF file in Adobe 8 and simply click the "enable commenting and reader" option and tada it is commenting enabled.  But i have been trying for quite a while now to find a way to perform this same functionality in code.  I looked into automating this process through Adobe Pro, but found the same result everywhere i looked and that was not possible.  Basically I am using itext to create PDFs and i want commenting to be enabled in reader for these PDFs, unfortunately i cannot perform this functionality with itext.

It seems absurd for me to even investigate LiveCycle Reader Extensions when this is the only functionality i require and i have heard pricing estimates to be from 50K - 1M.  Although i have downloaded the trial, but now have to downgrade my version of Java to even install the trial.  I have already found the code above and it appears that it will do what i need, but it is just not fiasble for me to get LiveCycle for this simple task.  Any known solutions on how to peform this task in code?

Avatar

Level 1

From everything I have read, there really is no way to do it.  Check out this thread:  http://forums.adobe.com/message/1957639

It sounds to me like this a business decision Adobe has made to try to strong arm people into buying a more expensive product than they need, based on the popularity of a single feature.  I did write a routine to do it with send keys, but it doesn't work for large batches unless you set a really long delay between files.  Personally, I think it is ridiculous, what would it take, like 2 seconds to add it to the API for Acrobat pro?

Avatar

Level 1

Dang, yeah that is pretty ridiculous.  The more I deal with Adobe software the more i dislike it.  Unfortunately they have gained high popularity by offering their viewing software free of charge and asking for the firstborn child of anyone who wishes to use their tools and the second born when they realize even more tools are required to do something as simple as this.

Thanks for the information though.  Looks like we will just not be able to allow commenting on the documents.

I am also searching for enable usage rights in order to comment, fill out form data. is there any other way to do this programatically with c++. 

Jyothi

Avatar

Employee

Hi,

As per End User License Agreeements there are some restrictions on distribution of PDF files that are Reader Extended using Acrobat.

One has to use LiveCycle in case their requirement is to distribute Reader Extended files to more than 500 people.

There seems to be a Lite version of Reader Extensions server for customers who do not want to install entire LiveCycle server product just for Reader Extensions , contact Adobe LiveCycle Enterprise sales/support team for more and accurate information on it

Mr.Santosh,

        we are creating pdfs with pdf operators, catalog , annots, fields, javascript etc. we are supporting till adobe 5.0, 6.0, and 7.0. To the updated versions inorder to support we need to extend it to XFA forms as acroform is not supporting in upper versions like 8.0, 9.0. when we tried with adobe live cycle files in that normal pdf page content they are not using pdf operators. need a sample file how to go with normal pdf page content and operators and for form need to go with xfa architecture. In XFA we need not write the whole page content in xml format right.

can you put some more light on the above.

Thanks.

Regards

c.siva jyothi

Avatar

Employee

Siva Jyothi,

Can you be more specific about what you are looking for in AcroForms that are not supported in versions 8.0 & 9.0? and what exactly are you trying to achieve using XFA forms

--Santosh

if we use xfa forms in our pdf then only our pdfs javascript will work in updated versions.

Also export data to xml will work. for tagged pdf it needs to have structure of xfa inside pdf

right.

regards

c.siva jyothi

On Tue, 29 Jan 2013 01:27:39 +0530 wrote

Re: How do you programmatically "enable for commenting"?

created by N Santosh Kumar in LiveCycle Reader Extensions - View the full discussion

Siva Jyothi,  Can you be more specific about what you are looking for in AcroForms that are

not supported in versions 8.0 & 9.0? and what exactly are you trying to achieve using XFA

forms  --Santosh

Please note that the Adobe Forums do not accept email attachments. If you want to

embed a screen image in your message please visit the thread in the forum to embed the image

at http://forums.adobe.com/message/5028826#5028826

Replies to this message go to everyone subscribed to this thread, not directly to the

person who posted the message. To post a reply, either reply to this email or visit the

message page:

To unsubscribe from this thread, please visit the message page at

. In the Actions box on the right, click the

Stop Email Notifications link.

Start a new discussion in LiveCycle Reader Extensions by email or at Adobe Community

For more information about maintaining your forum email notifications please go to

http://forums.adobe.com/message/2936746#2936746.

Avatar

Level 1

If you are using an Apple computer you can download an Automator service script that I made. It will enable you to select as many, or as few PDFs as you would like to enable comenting in and will automatically enable each PDF to "enable commenting". You can view the tutorial and download the Automator Script here:

http://www.youtube.com/watch?v=azRq6vRSVbs

Hope this helps.