PHP code example of label305 / pptx-extractor

1. Go to this page and download the library: Download label305/pptx-extractor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

label305 / pptx-extractor example snippets


use Label305\PptxExtractor\Basic\BasicExtractor;
use Label305\PptxExtractor\Basic\BasicInjector;

$extractor = new BasicExtractor();
$mapping = $extractor->extractStringsAndCreateMappingFile(
    'simple-slides.pptx',
    'simple-slides-extracted.pptx'
  );

echo $mapping[0][0]; // Slide number one

$mapping[0][0] = "Slide number one";

$injector = new BasicInjector();
$injector->injectMappingAndCreateNewFile(
    $mapping,
    'simple-slides-extracted.pptx',
    'simple-slides-injected.pptx'
  );

$extractor = new DecoratedTextExtractor();
$mapping = $extractor->extractStringsAndCreateMappingFile(
    'markup.pptx',
    'markup-extracted.pptx'
  );
  
$firstParagraph = $mapping[0]; // Paragraph object
$$firstTextRun = $firstParagraph[0]; // TextRun object

$firstTextRun->italic = true;
$firstTextRun->bold = false;
$firstTextRun->underline = true;

echo $firstTextRun->text; // The quick brown fox jumps over the lazy dog
$firstTextRun->text = "Several fabulous dixieland jazz groups played with quick tempo.";

$injector = new DecoratedTextInjector();
$injector->injectMappingAndCreateNewFile(
    $mapping,
    'markup-extracted.pptx',
    'markup-injected.pptx'
  );