addSvg

addSvg

BASIC / ADVANCED / PREMIUM

Inserts an SVG into the PowerPoint presentation.

Description
public addSvg($svg, $position, $svgStyles = array(), $options = array())

You may use this method to insert an SVG content, as file or string, into the PowerPoint presentation.

To keep compatibility with PPTX readers not compatible with SVG images, a PNG image with the same content is added too in the presentation.

Parameters

svg

File path or SVG content.

position

Key Type Description
new array

A new position is generated.

  • 'coordinateX' (int) EMUs (English Metric Unit).
  • 'coordinateY' (int) EMUs (English Metric Unit).
  • 'sizeX' (int) EMUs (English Metric Unit).
  • 'sizeY' (int) EMUs (English Metric Unit).
  • 'name' (string) placeholder internal name. If not set, a random name is generated.
  • 'order' (int) set the display order. Default after existing contents. 0 is the first order position. If the order position doesn't exist add after existing contents.

svgStyles

Key Type Description
border array
  • 'dash' (string) solid, dot, dash, lgDash, dashDot, lgDashDot, lgDashDotDot, sysDash, sysDot, sysDashDot, sysDashDotDot.
  • 'color' (string) default as 000000.
  • 'width' (int) EMUs (English Metric Unit). Default as 12700 (1pt).
descr string Descr value.
rotation int Rotation value.
Exceptions

ImageMagick extension is not enabled.

Position not valid.

Code samples

Example #1

The resulting PPTX looks like:

Release notes
  • phppptx 3.0:
    • new method.