JSON API - watermarkDocx
- addBarcode
- addBookmark
- addBreak
- addCaption
- addChart
- addComment
- addCrossReference
- addDateAndHour
- addDropCap
- addEndnote
- addExternalFile
- addFootnote
- addFormElement
- addHeading
- addImage
- addLink
- addList
- addMathEquation
- addMergeField
- addPageNumber
- addRuby
- addSimpleField
- addStructuredDocumentTag
- addSVG
- addTab
- addTable
- addTableContents
- addTableFigures
- addText
- addTextBox
- addWordML
- addWordFragment
- embedHTML
- addBackgroundImage
- addFooter
- addFooterSection
- addHeader
- addHeaderSection
- addLineNumbering
- addPageBorders
- addProperties
- addSection
- createCharacterStyle
- createListStyle
- createParagraphStyle
- createTableStyle
- docxSettings
- embedFont
- modifyPageLayout
- removeFooters
- removeHeaders
- setBackgroundColor
- setCompatibilityMode
- setDefaultFont
- setDocumentDefaultStyles
- setLanguage
- setMarkAsFinal
- setRTL
- clearBlocks
- cloneBlock
- deleteBlock
- getTemplateVariables
- getTemplateVariablesType
- modifyInputFields
- modifyMergeFields
- processTemplate
- removeTemplateVariable
- removeTemplateVariableImage
- replaceBlock
- replaceListVariable
- replacePlaceholderImage
- replaceTableVariable
- replaceVariableByExternalFile
- replaceVariableByHTML
- replaceVariableByText
- replaceVariableByWordFragment
- replaceVariableByWordML
- setTemplateSymbol
- setTemplateBlockSymbol
- tickCheckboxes
watermarkDocx
PREMIUM
TRIAL / ADVANCED
Inserts a watermark into a Word document.
Note
You are reading the JSON API documentation. For the PHP API method please go to watermarkDocx.
JSON data
| Key | Description |
|---|---|
| document | Word document to insert the watermark into. Path to the local document, Base64 string, or URL. |
| type | Watermark type: "text" or "image". |
| remove_previous_watermarks | If true (default) removes previous watermarks. |
| scope | header (default) or footer. Do not set a value to use header as scope. |
| section | All if not set. Allows adding a watermark per section. |
If "type" is "image":
| Key | Description |
|---|---|
| image | Path to the local image, Base64 string, or URL. |
| height | Watermark image height in pixels (optional). |
| width | Watermark image width in pixels (optional). |
| decolorate | If true (default) decolorates the image. |
| gain | Optional value to customize decoloration: hexadecimal value. |
| blacklevel | Optional value to customize decoloration: hexadecimal value. |
If "type" is "text":
| Key | Type | Description |
|---|---|---|
| text | The string of text used for watermarking. | |
| text_orientation | Orientation: diagonal (default) or horizontal. | |
| height | Watermark text height in pixels (optional). | |
| width | Watermark text width in pixels (optional). | |
| font | The font-family. If not set defaults to Calibri. | |
| bold | Bold style. | |
| italic | Italic style. | |
| color | Hexadecimal value or color name (defaults to silver). | |
| opacity | Decimal number between 0 and 1. If not set defaults to 0.5 | |
| add_vshapetype_tag | If true (default as false) adds a v:shapetype tag to force LibreOffice to display the text watermark. |
Code samples
Example #1
A document can be a local file, a Base64 string, or a remote file.
An image can be a local file, a Base64 string, or a remote file.
Example #2
A document can be a local file, a Base64 string, or a remote file.
Release notes
- phpdocx 18.0:
- new action.
