Inspecting Policy Protected PDF Documents

You can use the Rights Management Service API (Java and web service) to inspect policy-protected PDF documents. Inspecting policy-protected PDF documents returns information about the policy-protected PDF document. You can, for example, determine the policy that was used to secure the document and the date when the document was secured.

You cannot perform this task if your version of LiveCycle ES is 8.x or an earlier version. Support for inspecting policy-protected documents was added in LiveCycle. If you attempt to inspect a policy-protected document using LiveCycle ES 8.x (or earlier), an exception is thrown.

Remarque : For more information about the Rights Management service, see Services Reference for LiveCycle.

Summary of steps

To inspect a policy-protected PDF document, perform the following steps:

  1. Include project files.

  2. Create a Rights Management Client API object.

  3. Retrieve a policy-protected document to inspect.

  4. Obtain information about the policy-protected document.

Include project files

Include necessary files into your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, make sure that you include the proxy files.

Create a Rights Management Client API object

Before you can programmatically perform a Rights Management service operation, create a Rights Management service client object. If you are using the Java API, create a RightsManagementClient object. If you are using the Rights Management web service API, create a RightsManagementServiceService object.

Retrieve a policy-protected document to inspect

To inspect a policy-protected document, retrieve it. If you attempt to inspect a document that is not secured with a policy or is revoked, an exception is thrown.

Inspect the document

After you retrieve a polciy-protected document, you can inspect it.

Obtain information about the policy-protected document

After you inspect a policy-protected PDF document, you can obtain information about it. For example, you can determine the policy that is used to secure the document.

If you secure a document with a policy that belongs to My Policies and then call RMInspectResult.getPolicysetName or RMInspectResult.getPolicysetId, null is returned.

If the document is secured using a policy that is contained in a policy set (other than My Policies) then RMInspectResult.getPolicysetName and RMInspectResult.getPolicysetId return valid strings.

Inspect Policy Protected PDF Documents using the Java API

Inspect a policy-protected PDF document by using the Rights Management Service API (Java):

  1. Include project files.

    Include client JAR files, such as the adobe-rightsmanagement-client.jar, in your Java project’s class path. For information about the location of these files, see Including LiveCycle Java library files.

  2. Create a Rights Management Client API object.

    • Create a ServiceClientFactory object that contains connection properties. (See Setting connection properties.)

    • Create a RightsManagementClient object by using its constructor and passing the ServiceClientFactory object.

  3. Retrieve a policy-protected document to inspect.

    • Create a java.io.FileInputStream object that represents the policy-protected PDF document by using its constructor. Pass a string value that specifies the location of the PDF document.

    • Create a com.adobe.idp.Document object by using its constructor and passing the java.io.FileInputStream object.

  4. Inspect the document.

    • Create a DocumentManager object by invoking the RightsManagementClient object’s getDocumentManager method.

    • Inspect the policy-protected document by invoking the LicenseManager object’s inspectDocument method. Pass the com.adobe.idp.Document object that contains the policy-protected PDF document. This method returns a RMInspectResult object that contains information about the policy-protected document.

  5. Obtain information about the policy-protected document.

    To obtain information about the policy-protected document, invoke the appropriate method that belongs RMInspectResult object. For example, to retrieve the policy name, invoke the RMInspectResult object’s getPolicyName method.

Code examples

For code examples using the Rights Management service, see the following Quick Starts in API Quick Starts (Code Examples):

  • “Quick Start (EJB mode): Inspecting policy protected PDF documents using the Java API”

  • “Quick Start (SOAP mode): Inspecting policy protected PDF documents using the Java API”

Inspect Policy Protected PDF Documents using the web service API

Inspect a policy-protected PDF document by using the Rights Management Service API (web service):

  1. Include project files.

    Create a Microsoft .NET project that uses MTOM. Ensure that you use the following WSDL definition: http://localhost:8080/soap/services/RightsManagementService?WSDL&lc_version=9.0.1.

    Remarque : Replace localhost with the IP address of the server hosting LiveCycle.
  2. Create a Rights Management Client API object.

    • Create a RightsManagementServiceClient object by using its default constructor.

    • Create a RightsManagementServiceClient.Endpoint.Address object by using the System.ServiceModel.EndpointAddress constructor. Pass a string value that specifies the WSDL to the LiveCycle service (for example, http://localhost:8080/soap/services/RightsManagementService?WSDL.) You do not need to use the lc_version attribute. This attribute is used when you create a service reference.)

    • Create a System.ServiceModel.BasicHttpBinding object by getting the value of the RightsManagementServiceClient.Endpoint.Binding field. Cast the return value to BasicHttpBinding.

    • Set the System.ServiceModel.BasicHttpBinding object’s MessageEncoding field to WSMessageEncoding.Mtom. This value ensures that MTOM is used.

    • Enable basic HTTP authentication by performing the following tasks:

      • Assign the LiveCycle user name to the field RightsManagementServiceClient.ClientCredentials.UserName.UserName.

      • Assign the corresponding password value to the field RightsManagementServiceClient.ClientCredentials.UserName.Password.

      • Assign the constant value HttpClientCredentialType.Basic to the field BasicHttpBindingSecurity.Transport.ClientCredentialType.

    • Assign the constant value BasicHttpSecurityMode.TransportCredentialOnly to the field BasicHttpBindingSecurity.Security.Mode.

  3. Retrieve a policy-protected document to inspect.

    • Create a BLOB object by using its constructor. The BLOB object is used to store a PDF document to inspect.

    • Create a System.IO.FileStream object by invoking its constructor. Pass a string value that represents the file location of the PDF document and the mode to open the file in.

    • Create a byte array that stores the content of the System.IO.FileStream object. You can determine the size of the byte array by getting the System.IO.FileStream object’s Length property.

    • Populate the byte array with stream data by invoking the System.IO.FileStream object’s Read method. Pass the byte array, starting position, and stream length to read.

    • Populate the BLOB object by assigning its MTOM field with the contents of the byte array.

  4. Inspect the document.

    Inspect the policy-protected document by invoking the RightsManagementServiceClient object’s inspectDocument method. Pass the BLOB object that contains the policy-protected PDF document. This method returns a RMInspectResult object that contains information about the policy-protected document.

  5. Obtain information about the policy-protected document.

    To obtain information about the policy-protected document, get the value of the appropriate field that belongs to the RMInspectResult object. For example, to retrieve the policy name, get the value of the RMInspectResult object’s policyName field.

Code examples

For code examples using the Rights Management service, see the following Quick Starts in API Quick Starts (Code Examples):

  • “Quick Start (MTOM): Inspecting policy protected PDF documents using the web service API”

  • “Quick Start (SwaRef): Inspecting policy protected PDF documents using the web service API”