Add Watermarks

This REST API allows adding watermarks inside the documents.

With this API you can add watermarks with following features:

  • The watermark could be either a text or an image:
    • Image watermark supports various image formats: PNG, GIF, TIFF, JPG.
  • You may upload the desired image to the Storage and then pass the path as a parameter of Watermark operation;
    • For a Text watermark, you can use various text options like Font, Size, Style, Foreground and Background colors, etc.;
  • There are many watermark positioning and transforming properties;
  • There are format-specific options. These options allow to leverage specific format features and often allow to make watermarks stronger;
  • For protected documents, it is required to provide the password.

The table below contains the full list of properties that can be specified when creating watermarks inside of the document.

NameDescriptionComment
FileInfo.FilePathThe path of the document, located in the storage.Required.
FileInfo.StorageNameStorage nameIt could be omitted for default storage.
FileInfo.PasswordThe password to open fileIt should be specified only for password-protected documents.
OutputFolderThe folder for the resultant file.Default value is “/add_watermarks”
WatermarkDetailsCollection of watermarks to be added.It contains both text and image watermarks and their details.
WatermarkDetails.ProtectLevelLevel of document protection.The default value is ‘Document’ - adds watermarks only inside the document. Possible values: ‘Images’ - adds watermarks only on images inside the document. ‘DocumentAndImages’ - protect both document and images.
WatermarkDetails.PdfOptionsSpecific options for PDF documents.
WatermarkDetails.ImageOptionsSpecific options for Image documents.
WatermarkDetails.PresentationOptionsSpecific options for Presentations.
WatermarkDetails.WordProcessingOptionsSpecific options for Word processing documents.
WatermarkDetails.SpreadsheetOptionsSpecific options for Spreadsheet documents.
WatermarkDetails.DiagramOptionsSpecific options for Diagram documents.

Watermark Details

NameDescriptionComment
TextWatermarkOptionsOptions for text watermarkRequired if text watermark needs to be added
TextWatermarkOptions.TextText to be used as a watermarkRequired
TextWatermarkOptions.FontFamilyNameThe family name of the text fontRequired
TextWatermarkOptions.FontSizeSize of the fontRequired
TextWatermarkOptions.FontStyleStyle of the fontPossible values: Bold, Italic, Regular, Strikeout, Underline
TextWatermarkOptions.ForegroundColorThe foreground color of the text
TextWatermarkOptions.BackgroundColorBackground color of the text
TextWatermarkOptions.TextAlignmentText alignment.Possible values: Left, Right, Center, Justify
ImageWatermarkOptionsOptions for image watermarkRequired if image watermark needs to be added
ImageWatermarkOptions.ImageImage for the watermarkRequired
Image.FilePathThe path of the image, located in the storage.Required
Image.StorageNameStorage name
Image.PasswordThe password to open image
PositionWatermark positionDefines placement of the watermark on document page
Position.XX-coordinate of the watermark
Position.YY-coordinate of the watermark
Position.WidthDesired width of the watermark
Position.HeightThe desired height of the watermark
Position.HorizontalAlignmentWatermark horizontal alignmentPossible values: Center, Left, Right, None
Position.VerticalAlignmentWatermark vertical alignmentPossible values: Bottom, Center, Top, None
Position.MarginsWatermark margin settings
Margins.MarginTypeMargin typePossible values: Absolute, RelativeToParentDimensions, RelativeToParentMinDimension
Margins.RightValue of right margin
Margins.LeftValue of left margin
Margins.TopValue of top margin
Margins.BottomValue of bottom margin
Position.SizingTypeSpecifies how to watermark size should be calculatedPossible values: Absolute, Auto, ScaleToParentArea, ScaleToParentDimensions
Position.ScaleFactorGets or sets a value that defines how watermark size depends on parent size.
Position.RotateAngleRotate angle of the watermarkValue in degrees
Position.ConsiderParentMarginsIndicates whether the watermark size and coordinates are calculated considering parent margins
Position.IsBackgroundIndicates whether the watermark should be placed at the background.
OpacityThe opacity of the watermark

PdfOptions

NameDescriptionComment
PrintOnlyAnnotationWatermarksIndicates whether annotation watermarks should be added and should be visible only while printing
RasterizeIndicates whether the document should be rasterized.Converts all content pages into images.
RasterizeImageFormatPDF image conversion formatPossible values: Jpeg, Png, Gif
PagesPages to add watermarks to

ImageOptions

NameDescriptionComment
FramesFrames of the multi-frame image to add watermark

PresentationOptions

NameDescriptionComment
ProtectWithUnreadableCharactersIndicates whether the text watermark characters are mixed with unreadable charactersThis protection applies only when LockWatermarks property is true
LockWatermarksIndicates whether editing of the watermark in PowerPoint is forbidden.
SlidesSlides to add watermarks to

WordProcessingOptions

NameDescriptionComment
WatermarkLockTypeType of watermark lock.Possible values: AllowOnlyComments, AllowOnlyFormFields, AllowOnlyRevisions, NoLock(default), ReadOnly, ReadOnlyWithEditableContent
WatermarkPasswordPassword used to lock the watermark.
LockWatermarksIndicates whether editing of the shape in Word is forbidden.If true, WatermarkLockType set to ReadOnly.
PagesPages to add watermarks toIt starts from 1.

SpreadsheetOptions

NameDescriptionComment
LockWatermarksIndicates whether editing of the shape in Excel is forbidden.
WorksheetsWorksheets to add watermarks to

DiagramOptions

NameDescriptionComment
PlacementTypeSpecifying to what pages a watermark should be added.Possible values: AllPages, BackgroundPages, Default, ForegroundPages, SeparateBackgrounds. The default is the same as ForegroundPages.
LockWatermarksIt indicates whether editing of the shape in Visio is forbidden.
WorksheetsWorksheets to add watermarks to.

Resource URI

HTTP POST ~~/watermark

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