Spire.Cloud.Word API provides developers with the WatermarksApi interface to remove the text watermark and image watermark in Word documents. This article will introduce how to remove text watermark in a Word document by using this API.
The original Word document that contains a text watermark is shown as below:
import spire.cloud.word.sdk.client.*;
import spire.cloud.word.sdk.client.api.WatermarksApi;
public class RemoveWatermark {
static String appId = "APP ID";
static String appKey = "APP Key";
static String baseUrl = "https://api.cloudxdocs.com";
//Create a Configuration object based on App ID, App Key and base Url
static Configuration wordConfiguration = new Configuration(appId, appKey, baseUrl);
//Create an instance of WatermarksApi
static WatermarksApi watermarksApi = new WatermarksApi(wordConfiguration);
public static void main(String[] args) throws ApiException {
//Specify the name of the input document
String fileName = "Spire.Cloud.Word.docx";
//Specify the folder where the input document is stored, set it to null if there's none
String folder = "input";
//Specify the original password of the input document, set it to null if there's none
String password = null;
//Store the document in the 2G default storage space offered by E-iceblue Cloud
String storage = null;
//Specify the storage path and name of the generated document
String destFilePath = "output/deleteWatermark.docx";
//Remove watermark in the document with the deleteWatermark method
watermarksApi.deleteWatermark(fileName, destFilePath, folder, storage, password);
}
}
Output: