Modifying Watermarks

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.
Note: For more information about the Rights Management service, see Services Reference for LiveCycle.

Summary of steps

To modify a watermark, perform the following steps:

  1. Include project files.

  2. Create a Rights Management Client API object.

  3. Retrieve the watermark to modify.

  4. Set the watermarks attributes.

  5. 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.
Note: For information about the watermark attribute names, see Creating Watermarks.

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):

  1. Include project files.

    Include client JAR files, such as the adobe-rightsmanagement-client.jar, in your Java project’s class path.

  2. Create a Rights Management Client API object.

    • Create a ServiceClientFactory object that contains connection properties.

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

  3. 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.

  4. 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.
  5. Update the watermark.

    • Update the watermark by invoking the WatermarkManager object’s updateWatermark method and pass the Watermark object whose attribute was modified.

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): Modifying a watermark using the Java API”

  • “Quick Start(SOAP mode): Modifying a watermark using the Java API”

Modify watermarks using the web service API

Modify a watermark by using the Rights Management 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.

    Note: 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 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.

  4. 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.

  5. 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.

Code examples

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

  • “Quick Start (MTOM): Modifying a watermark using the web service API”

// Ethnio survey code removed