Conversion plugin phppptx
Running the first example and available options
You can transform files with the CreatePptx class methods or directly calling the transformation classes.
This would be an easy example to create a PPTX and convert it to PDF:
Or to transform an existing PPTX:
The conversion plugin type to use in both examples is the one defined in the configuration file config/phppptxconfig.ini.
The transform method has some parameters which you may have to customize.
Here's the signature of the method:
These are the available parameters:
source
Path to the PPTX that you want to convert to a different format.
target
Path to the resulting transformed document (PDF, PPT or ODP).
method
Method used to transform the document: 'libreoffice', 'mspowerpoint'.
'libreoffice' method options
The possible keys and values are:
Key | Type | Description |
---|---|---|
debug | bool | False by default. Returns debug information about the conversion plugin. |
extraOptions | string | Extra parameters to be used when doing the conversion. |
homeFolder | string | Set a custom home folder to be used for the conversions. |
outdir | string | Set the outdir path. Useful when the PDF output path is not the same than the running script. |
'mspowerpoint' method options
The possible keys and values are:
Key | Type | Description |
---|---|---|
selectedContent | string | Scope: 'active' (default) or 'documents'. |
If you don't need to generate a new presentation and you just need to make the conversion, you can directly instantiate the following classes:
- TransformLibreOffice, for LibreOffice
- TransformMSPowerPoint, for MS PowerPoint
Working with these classes is as simple as including the autoloader:
Then instantiate an object with the desired class:
For LibreOffice:
for MS PowerPoint:
And then call the transformation:
The transformation classes don't have a method option.