watermark
watermark
ADVANCED / PREMIUM
BASIC
Inserts a watermark into an Excel spreadsheet.
Description
public watermark($source, $target, $type = 'text', $options = array())
This method allows to insert a watermark text or image into an XLSX spreadsheet.
Parameters
source
The path to the source XLSX file.
target
The path to the XLSX file resulting after adding the watermark.
type
'text' or 'image'.
options
The possible keys and values are:
| Key | Type | Description |
|---|---|---|
| colSize | int | Number of cols. Default as 6. |
| rowSize | int | Number of rows. Default as 6. |
| position | string | Cell position. Default as 'F15'. |
| rotation | int | 60.000ths of a degree. Default as 315. |
| transparency | int | 0 to 100. Default as 60. |
If type is 'text':
| Key | Type | Description |
|---|---|---|
| text | string | The string of text used for watermarking. Default as 'DRAFT'. |
| backgroundColor | string | FFFF00, CCCCCC..., none. Default as 'none'. |
| color | string | Hexadecimal value or color name. Default as '7D7F7C'. |
| fontSize | int | 8, 9, 10, 11 ... Default as 60. |
If type is 'image':
| Key | Type | Description |
|---|---|---|
| image | Image file path, base64, stream or GdImage. | Watermark image. |
Exceptions
Unknown watermark type.
Image not provided.
Image format is not supported.
Release notes
- phpxlsx 5.5:
- new method.