JSON API - watermarkPdf
- 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
watermarkPdf
PREMIUM
TRIAL / ADVANCED
Inserts a watermark into a PDF document.
Note
You are reading the JSON API documentation. For the PHP API method please go to watermarkPdf.
JSON data
| Key | Description |
|---|---|
| document | PDF document to insert the watermark into. Path to the local document, Base64 string, or URL. |
| type | Watermark type: "text" or "image". |
| annotations | Import annotations (links, comments and others). Default as false. |
| pages | All if not set. Allows adding a watermark per page. |
| useFixedAnnotationPositions | Force annotation page link IDs. Useful when using PDF readers that don't detect all PDF contents automatically. Default as false. |
If "type" is "image":
| Key | Description |
|---|---|
| image | Path to the local image, Base64 string, or URL. |
| positionX | X-asis position (page center as default). |
| positionY | Y-asis position (page center as default). |
| opacity | Decimal number between 0 and 1(optional), if not set defaults to 0.5. |
| height | Height value (proportional). |
| width | Width value (proportional). |
If "type" is "text":
| Key | Type | Description |
|---|---|---|
| text | The string of text used for watermarking. | |
| positionX | X-asis position (page center as default). | |
| positionY | Y-asis position (page center as default). | |
| opacity | Decimal number between 0 and 1(optional), if not set defaults to 0.5. | |
| font | The font-family. It must be installed in the OS. | |
| size | Font size. | |
| color | RGB: array(r, g, b) (array(255, 255, 255)). |
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.
