Replace Watermarks

This REST API allows replacing watermarks in the document.

The operation performs a search for possible watermarks and then performs replacement operations over them.

The API supports a rich set of search criteria that allows finding images and texts that may be possible watermarks.

With this operation, you may replace found watermark properties: watermark image, text or/and text appearance options like font, size, color, etc.

The table below contains the full list of properties.

NameDescriptionComment
FileInfo.FilePathThe path of the document, located in the storageRequired
FileInfo.StorageNameStorage nameCould be omitted for default storage
FileInfo.PasswordPassword to open fileShould be specified only for password-protected documents
OutputFolderThe folder for the resultant file“watermark/replaced_watermark” is default
TextSearchCriteriaSearch criteria allowing filtering by watermark text
TextSearchCriteria.SearchTextThe exact string to search for
ImageSearchCriteriaSearch criteria for finding images
ImageSearchCriteria.ImageFileInfoImage to search for.
ImageFileInfo.FilePathThe path of the image, located in the storageRequired
ImageFileInfo.StorageNameStorage name
ImageFileInfo.PasswordThe password to open image
SizeSearchCriteriaSearch criteria allowing filtering by watermark size
SizeSearchCriteria.DimensionThe dimension of a watermark to search byPossible values: Height, Width
SizeSearchCriteria.MaximumDimension ending value
SizeSearchCriteria.MinimumDimension starting value
RotateAngleSearchCriteriaSearch criteria allowing filtering by watermark rotate angle
RotateAngleSearchCriteria.MaximumAngleEnding angle in degrees
RotateAngleSearchCriteria.MinimumAngleStarting angle in degrees
TextFormattingSearchCriteriaSearch criteria allowing filtering by text formatting
TextFormattingSearchCriteria.ForegroundColorRangeThe range of colors which are used to filter watermarks by text foreground color
TextFormattingSearchCriteria.BackgroundColorRangeThe range of colors which are used to filter watermarks by the text background color.
TextFormattingSearchCriteria.FontNameName of the font which is used in possible watermark text formatting.
TextFormattingSearchCriteria.MinFontSizeStarting value of the font size.
TextFormattingSearchCriteria.MaxFontSizeEnding value of the font size.
TextFormattingSearchCriteria.FontBoldIndicating whether the font used in watermark text formatting is bold.
TextFormattingSearchCriteria.FontUnderlineIndicating whether the font used in watermark text formatting is underline.
TextFormattingSearchCriteria.FontStrikeoutIndicating whether the font used in watermark text formatting is a strikeout.
TextFormattingSearchCriteria.FontItalicIndicating whether the font used in watermark text formatting is italic.
ReplaceTextOptionsParameters of text to replace found text watermarks details
ReplaceTextOptions.TextNew text for the watermarkRequired for text replacement
ReplaceTextOptions.FontFamilyFont name for a textLeft the same if not specified
ReplaceTextOptions.SizeFont size for new textLeft the same if not specified
ReplaceTextOptions.StyleStyle of a new text
ReplaceTextOptions.ForegroundColorForeground color for a new text
ReplaceTextOptions.BackgroundColorBackground color for a new text
ReplaceImageOptionsParameters of the image to replace found image watermarks details
ReplaceImageOptions.ImageNew image for watermark
Image.FilePathThe path of the image, located in the storageRequired
Image.StorageNameStorage name
Image.PasswordThe password to open image

ColorRange

NameDescriptionComment
ColorThe exact color from which the range is created
IsEmptyIndicates whether only the empty color is in range
MaxBrightnessThe ending brightness value.
MaxHueThe ending hue value, in degrees.
MaxSaturationThe ending saturation value.
MinBrightnessThe starting brightness value.
MinHueThe starting hue value, in degrees.
MinSaturationThe starting saturation value.

Color

NameDescriptionComment
AThe alpha component value of the color
RThe red component value of the color
GThe green component value of the color
BThe blue component value of the color
ARGBThe 32-bit ARGB value
NameA system-defined color name
IsEmptyIndicates whether Color is uninitialized

Resource URI

HTTP POST ~~/watermark/replace

Swagger UI lets you call this REST API directly from the browser.

cURL example

# First get JSON Web Token
# Please get your Client Id and Client Secret from https://dashboard.groupdocs.cloud/applications.
# Kindly place Client Id in "client_id" and Client Secret in "client_secret" argument.
curl -v "https://api.groupdocs.cloud/connect/token" \
-X POST \
-d "grant_type#client_credentials&client_id#xxxx&client_secret#xxxx" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
   
# cURL example to get document information
curl -v "https://api.groupdocs.cloud/v1.0/watermark/replace" \
-X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer <jwt token>"
-d "{
    "FileInfo": {
        "FilePath": "with_watermarks\\sample.pdf",
    },
    "ReplaceTextOptions": {
        "Text": "New watermark text",
        "Size": 0.0
    },
    "ReplaceImageOptions": {
        "Image": {
            "FilePath": "images\\sample.jpg"
        }
    },
    "TextSearchCriteria": {
        "SearchText": "Watermark text"
    },
    "ImageSearchCriteria": {
        "ImageFileInfo": {
            "FilePath": "watermark_images\\sample_watermark.png"
        }
    }
}"
{
    "downloadUrl": "https://api.groupdocs.cloud/v1.0/watermark/storage/file/replaced_watermarks/sample_pdf/sample.pdf",
    "path": "replaced_watermarks/sample_pdf/sample.pdf"
}

SDK examples

Our API is completely independent of your operating system, database system or development language. You can use any language and platform that supports HTTP to interact with our API. However, manually writing client code can be difficult, error-prone and time-consuming. Therefore, we have provided and support API SDKs in many development languages in order to make it easier to integrate with us. If you use SDK, it Replaces the Watermark API calls and lets you use GroupDocs Cloud features in a native way for your preferred language.