watermark

watermark

ADVANCED / PREMIUM BASIC

Inserts a watermark into a PPTX presentation.

Description
public watermark($source, $target, $type = 'text', $options = array())

This method allows to insert a watermark text or image into a PPTX presentation.

Parameters

source

The path to the source PPTX file.

target

The path to the PPTX file resulting after adding the watermark.

type

'text' or 'image'.

options

The possible keys and values are:

Key Type Description
coordinateX int EMUs (English Metric Unit). Default as 4000000.
coordinateY int EMUs (English Metric Unit). Default as 2000000.
sizeX int EMUs (English Metric Unit). Default as 4000000.
sizeY int EMUs (English Metric Unit). Default as 2000000.
name string Internal name. If not set, a random name is generated.
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'.
color string Hexadecimal value or color name. Default as '7D7F7C'.
fontSize int 8, 9, 10, 11 ... Default as 80.

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.

Code samples

Example #1

The resulting PPTX looks like:

Example #2

The resulting PPTX looks like:

Release notes
  • phppptx 4.5:
    • new method.