transformNativeHtml

transformNativeHtml

ADVANCED / PREMIUM BASIC

Transforms PPTX into HTML.

Description
public transform(TransformNativeHtmlPlugin $htmlPlugin, $options = array())

This method allows to transform a PPTX presentation, generated or not with phppptx, into HTML.

Tags, CSS, sizes and other transformations can be customized easily extending the classes and using plugins.

You may find more info regarding this method in the PPTX to HTML section.

Parameters

htmlPlugin

Plugin used to transform the PPTX, TransformNativeHtmlDefaultPlugin as default.

options

The possible keys and values are:

Key Type Description
javaScriptAtTop bool Adds the JavaScript at the top of the HTML. Default as false.
returnHtmlStructure bool If true returns an array with the structure of the PPTX transformed to HTML: (css, presentation, javascript. metas). Default as false.
Methods and attributes TransformNativeHtmlPlugin

generateClassName

Function to generate class names.

setBaseCSS

Base CSS to be added when transforming the document.

Default value: '<style>.slide{border: 1pt solid; margin-top: 10pt;} span.tabcontent{margin-left: 40px;} p {margin-block-start:0; margin-block-end:0; margin-inline-start:0; margin-inline-end:0;padding-block-start:0; padding-block-end:0; padding-inline-start:0; padding-inline-end:0</style>'.

setBaseHTML

Base HTML to be added when transforming the document.

Default value: '<!DOCTYPE html><html>'.

setBaseJavaScript

Base JavaScript to be added when transforming the document.

Default value: ''.

setBaseMeta

Base meta tags to be added when transforming the document.

Default value: '<meta charset="UTF-8">'.

setConversionFactor

Conversion factor to transform sizes. Default as 1.3.

setScaleFactor

Scale factor. Default as 600.

setExtraClasses

Extra classes to add for a tag.

setFilesAsBase64

Default as true. If false, save the files in the fs.

setOutputFilesPath

Set the output path folder of the external files (videos, images...).

setTag

Set a specific tag for a OOXML tag.

transformColors

Transform color values.

transformSizes

Transform size values.

Exceptions

Error while trying to open the (base) template as a zip file.

Code samples

Example #1

Release notes
  • phppptx 4.0:
    • new method.