PHP code example of synergitech / chrome-pdf-php

1. Go to this page and download the library: Download synergitech/chrome-pdf-php 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/ */

    

synergitech / chrome-pdf-php example snippets


use SynergiTech\ChromePDF\Chrome;
use SynergiTech\ChromePDF\Browserless;

$pdf = new Chrome('path-to-chrome-pdf');
$pdf->renderContent('<h1>test</h1>');

$pdf = new Browserless('your-api-key');
$pdf->renderContent('<h1>test</h1>');

use SynergiTech\ChromePDF\Browserless;

$pdf = new Browserless('your-api-key', Browserless\EndpointsEnum::London);

use SynergiTech\ChromePDF\Browserless;

// For information on options, see https://www.browserless.io/docs/screenshot#custom-options.
// `render()` defaults to using png and fullPage set to false
// but jpegs will get a quality of 75 set if you don't set one
$file = new Browserless\Screenshot('your-api-key');
$file->render('https://example.com');
$file->render('https://example.com', [
    'fullPage' => true,
    'type' => 'jpeg',
]);

composer