PHP code example of nelson-cms / pptr

1. Go to this page and download the library: Download nelson-cms/pptr 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/ */

    

nelson-cms / pptr example snippets

 php
$html = '<body style="color: #fff; background: rebeccapurple"><h1>Puppeteer test</h1><p>Some text paragraph</p>';
$html .= '<p>' . date(DateTime::ISO8601) . '</p>';
$html .= '</body>';

/** @var Generator $generator */
$generator = $this->generatorFactory->create();
$output = $generator->generateFromHtml($html, OutputMode::BOTH);
 php
/** @var \NelsonCms\Pptr\VO\Result $result */
$result = $generator->generateFromUrl(new UrlScript('https://www.google.com'), OutputMode::BOTH);