PHP code example of ottosmops / pdfvalidate

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

    

ottosmops / pdfvalidate example snippets


$validator = new \Ottosmops\Pdfvalidate\Validator('/path/to/file.pdf');  
if (!$validator->check()) {
    echo $validator->error;
    echo $validator->output; // original information
    exit(1);
} 

// the pdf should be ok
// do something useful ...

$validator = new \Ottosmops\Pdfvalidate\Validator($file, $executable = '', $timeout = 60); 
which pdftocairo