PHP code example of isset / alfredo

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

    

isset / alfredo example snippets


    "isset/alfredo": "1.*"

    composer update

    php composer.phar update

    $payload = new Alfredo\Payload\Pdf\Convert;
    $payload->addhtml('<html><thead></thead><tbody>test</tbody></html>');

    $payload = new Alfredo\Payload\Pdf\Convert;
    $pdf = file_get_contents('path/to/pdf/file.pdf');
    $payload->addPdf($pdf);

    $payload = new Alfredo\Payload\Pdf\Convert;
    $payload->addUrl('http://online-pdfconverter.nl');

    $payload = new Alfredo\Payload\Pdf\Convert;
    $payload->setCallback('http://example.com/callback_url');

    $payload = new Alfredo\Payload\Pdf\Convert;
    $payload->addhtml('<html><thead></thead><tbody>test</tbody></html>')
            ->addPdf(file_get_contents('path/to/pdf/file.pdf'))
            ->addUrl('http://online-pdfconverter.nl');
            ->setCallback('http://example.com/callback-response');

    $payload = new Alfredo\Payload\Pdf\Convert;
    $payload->setConverter('wkhtmltoppdf');

    $payload = new Alfredo\Payload\Pdf\Convert;
    $payload->addhtml('<html><thead></thead><tbody>test</tbody></html>');
    $server = new Alfredo\Server('http://converter.isset.nl', 'consumer_key', 'private_key');

    try {
        $response = $server->stream($payload);
        header('Content-type: application/pdf');
        echo $response
    } catch (Alfredo\ConversionUnableException $e) {
        echo $e->getMessage();
    }

    $payload = new Alfredo\Payload\Pdf\Convert;
    $payload->addhtml('<html><thead></thead><tbody>test</tbody></html>');
    $payload->setCallback('http://example.com/callback_url');

    $server = new Alfredo\Server('http://converter.isset.nl', 'consumer_key', 'private_key');

    $response = $server->queue($payload);

    $server = new Alfredo\Server('http://converter.isset.nl', 'consumer_key', 'private_key');

    $payload = new Alfredo\Payload\Pdf\QueueItem;
    $payload->setIdentifier('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');

    $pdf = $server->getQueueItem($payload);