You
can modify an existing watermark using the Rights Management Java
API or web service API. To make changes to an existing watermark,
you retrieve it, modify its attributes, and then update it on the
server. For example, assume that you retrieve an watermark and modify
its opacity attribute. Before the change takes effect, you must
update the watermark.
When you modify a watermark, the change impacts future documents
that have the watermark applied to them. That is, existing PDF documents
that contain the watermark are not affected.
Note:
Only users with Rights Management administrative
privileges can modify watermarks. That is, you must specify such
a user when defining connection settings required to create a Rights
Management service client object.
Summary of steps
To
modify a watermark, perform the following steps:
-
Include project files.
-
Create a Rights Management Client API object.
-
Retrieve the watermark to modify.
-
Set the watermarks attributes.
-
Update the watermark.
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 API object
Before you can programmatically
perform a Rights Management service operation, you must 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 the watermark to modify
To modify a watermark, you must
retrieve an existing watermark. You can retrieve a watermark by
specifying its name or by specifying its identifier value.
Set the watermarks attributes
To modify an existing watermark,
change the value of one or more watermark attributes. When programmatically
updating a watermark using a web service, you must set all of the
attributes that were originally set, even if the value does not
change. For example, assume the following watermark attributes are
set:
WaterBackCmd:IS_USERID_ENABLED
,
WaterBackCmd:IS_CUSTOMTEXT_ENABLED
,
WaterBackCmd:OPACITY
, and
WaterBackCmd:SRCTEXT
.
Although the only attribute that you want to modify is
WaterBackCmd:OPACITY
,
you must set the other values are well.
Note:
When
using the Java API to modify a watermark, you do not need to specify
all attributes. Set the watermark attribute that you want to modify.
Update the watermark
After you modify a watermark’s attributes,
you must update the watermark.
Modify watermarks using the Java API
Modify a watermark by using the Rights Management API (Java):
-
Include project files.
Include client JAR files,
such as the adobe-rightsmanagement-client.jar, in your Java project’s
class path.
-
Create a Rights Management Client API object.
-
Retrieve the watermark to modify.
Create a
WatermarkManager
object
by invoking the
RightsManagementClient
object’s
getWatermarkManager
method and
pass a string value that specifies the watermark name. This method returns
a
Watermark
object that represents the watermark
to modify.
-
Set the watermark attributes.
Set the watermark’s
opacity attribute by invoking the
Watermark
object’s
setOpacity
method
and passing an integer value that specifies the opacity level. A
value of 100 indicates the watermark is completely opaque and a
value of 0 indicates the watermark is completely transparent.
Note:
This example modifies only the opacity attribute.
-
Update the watermark.
Modify watermarks using the web service API
Modify a watermark 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 the watermark to modify.
Retrieve the watermark
to modify by invoking the
RightsManagementServiceClient
object’s
getWatermarkByName
method.
Pass a string value that specifies the watermark name. This method returns
a
WatermarkSpec
object that represents the watermark
to modify.
-
Set the watermark attributes.
-
For each watermark
property to update, create a separate
MyMapOf_xsd_string_To_xsd_anyType_Item
object.
-
Set the key value by assigning a value to the
MyMapOf_xsd_string_To_xsd_anyType_Item
object’s
key
data member
(for example,
WaterBackCmd:OPACITY)
.
-
Set the value by assigning a value to the
MyMapOf_xsd_string_To_xsd_anyType_Item
object’s
value
data
member (for example,
.50
).
-
Create a
MyArrayOf_xsd_anyType
object. For
each
MyMapOf_xsd_string_To_xsd_anyType_Item
object,
invoke the
MyArrayOf_xsd_anyType
object’s
Add
method.
Pass the
MyMapOf_xsd_string_To_xsd_anyType_Item
object.
-
Assign the
MyArrayOf_xsd_anyType
object
to the
WatermarkSpec
object’s
values
data
member.
-
Update the watermark.
Update the watermark by invoking
the
RightsManagementServiceClient
object’s
updateWatermark
method
and passing the
WatermarkSpec
object that represents
the watermark to modify.
|
|
|