In addition to PDF documents, the Rights Mangement service
supports additional document formats such as a Microsoft Word document
(DOC file) and other Micosoft office file formats. For example,
you can apply a policy to a Word document in order to secure it.
By applying a policy to a Word document, you restrict access to
the document. You cannot apply a policy to a document if the document
is already secured with a policy.
You can monitor the use of a policy-protected Word document after
you distribute it. That is, you can see how the document is being
used and who is using it. For example, you can find out when somebody
has opened the document.
Summary of steps
To apply a policy to a Word document,
perform the following steps:
-
Include project files.
-
Create a Rights Management Client API object.
-
Retrieve a Word document to which a policy is applied.
-
Apply an existing policy to the Word document.
-
Save the policy-protected Word document.
Include project files
Include necessary files into your development
project. If you are creating a client application using Java, then
include the necessary JAR files. If you are using web services,
then make sure that you include the proxy files.
Create a Rights Management Client APIobject
Before you can programmatically
perform a Rights Management service operation, you must create a
Rights Management service client object.
Retrieve a Word document
You must retrieve a Word document in order
to apply a policy. After you apply a policy to the Word document,
users are restricted when using the document. For example, if the
policy does not enable the document to be opened while offline, then
users must be online to open the document.
Apply an existing policy to the Word document
To apply a policy
to a Word document, you must reference an existing policy and specify
which policy set the policy belongs to. The user who is setting
the connection properties must have access to the specified policy.
If not, an exception occurs.
Save the Word document
After the Rights Management service
applies a policy to a Word document, you can save the policy-protected
Word document as a DOC file.
Apply a policy to a Word document using the Java API
Apply a policy to a Word document by using the Rights Management
API (Java):
-
Include project files.
Include client JAR files,
such as adobe-rightsmanagement-client.jar, in your Java project’s
class path.
-
Create a Rights Management Client API object.
-
Retrieve a Word document.
-
Create a
java.io.FileInputStream
object
that represents the Word document by using its constructor and passing
a string value that specifies the location of the Word document.
-
Create a
com.adobe.idp.Document
object by
using its constructor and passing the
java.io.FileInputStream
object.
-
Apply an existing policy to the Word document.
-
Create a
DocumentManager
object by invoking
the
RightsManagementClient
object’s
getDocumentManager
method.
-
Apply a policy to the Word document by invoking the
DocumentManager
object’s
protectDocument
method
and passing the following values:
-
The
com.adobe.idp.Document
object
that contains the Word document to which the policy is applied.
-
A string value that specifies the name of the document.
-
A string value that specifies the name of the policy set
to which the policy belongs. You can specify a
null
value
that results in the
MyPolicies
policy set being
used.
-
A string value that specifies the policy name.
-
A string value that represents the name of the user manager
domain of the user who is the publisher of the document. This parameter
value is optional and can be null (if this parameter is null, then
the next parameter value must be null).
-
A string value that represents the name of the canonical
name of the user manager user who is the publisher of the document.
This parameter value is optional and can be
null
(if
this parameter is
null
, then the previous parameter
value must be
null
).
-
A
com.adobe.livecycle.rightsmanagement.Locale
that represents
the locale that is used for selecting the MS Office template. This
parameter value is optional and you can specify
null
.
The
protectDocument
method
returns a
RMSecureDocumentResult
object that contains
the policy-protected Word document.
-
Save the Word document.
-
Invoke the
RMSecureDocumentResult
object’s
getProtectedDoc
method
to get the policy-protected Word document. This method returns a
com.adobe.idp.Document
object.
-
Create a
java.io.File
object and ensure
that the file extension is DOC.
-
Invoke the
com.adobe.idp.Document
object’s
copyToFile
method to
copy the contents of the
Document
object to the
file (ensure that you use the
Document
object that
was returned by the
getProtectedDoc
method).
Apply a policy to a Word document using the web service API
Apply a policy to a Word document by using the Rights Management
API (web service):
-
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
.
Note:
Replace
localhost
with the IP
address of the server hosting LiveCycle.
-
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 AEM forms 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
.
-
Retrieve a Word document.
-
Create a
BLOB
object
by using its constructor. The
BLOB
object is used
to store a Word document to which a policy is applied.
-
Create a
System.IO.FileStream
object by
invoking its constructor and passing a string value that represents
the file location of the Word document and the mode in which to
open the file.
-
Create a byte array that stores the content of the
System.IO.FileStream
object.
Determine the byte array size 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, the starting position, and the stream length
to read.
-
Populate the
BLOB
object by assigning its
MTOM
field
with the contents of the byte array.
-
Apply an existing policy to the Word document.
Apply
a policy to the Word document by invoking the
RightsManagementServiceClient
object’s
protectDocument
method
and passing the following values:
-
The
BLOB
object
that contains the Word document to which the policy is applied.
-
A string value that specifies the name of the document.
-
A string value that specifies the name of the policy set
to which the policy belongs. You can specify a
null
value
that results in the
MyPolicies
policy set being
used.
-
A string value that specifies the policy name.
-
A string value that represents the name of the user manager
domain of the user who is the publisher of the document. This parameter
value is optional and can be null (if this parameter is null, then
the next parameter value must be
null
).
-
A string value that represents the name of the canonical
name of the user manager user who is the publisher of the document.
This parameter value is optional and can be null (if this parameter
is null, then the previous parameter value must be
null
).
-
A
RMLocale
value that specifies the locale
value (for example,
RMLocale.en
).
-
A string output parameter that is used to store the policy
identifier value.
-
A string output parameter that is used to store the policy-protected identifier
value.
-
A string output parameter that is used to store the mime
type (for example,
application/doc
).
The
protectDocument
method
returns a
BLOB
object that contains the policy-protected
Word document.
-
Save the Word document.
-
Create a
System.IO.FileStream
object
by invoking its constructor and passing a string value that represents
the file location of the policy-protected Word document.
-
Create a byte array that stores the data content of the
BLOB
object
that was returned by the
protectDocument
method.
Populate the byte array by getting the value of the
BLOB
object’s
MTOM
data
member.
-
Create a
System.IO.BinaryWriter
object by
invoking its constructor and passing the
System.IO.FileStream
object.
-
Write the contents of the byte array to a Word file by invoking
the
System.IO.BinaryWriter
object’s
Write
method
and passing the byte array.
|
|
|