1. Go to this page and download the library: Download mishagp/ocrmypdf 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/ */
mishagp / ocrmypdf example snippets
use mishagp\OCRmyPDF\OCRmyPDF;
//Return file path of outputted, OCRed PDF
echo OCRmyPDF::make('document.pdf')->run();
//Return file contents of outputted, OCRed PDF
echo OCRmyPDF::make('scannedImage.png')->setOutputPDFPath(null)->run();
use mishagp\OCRmyPDF\OCRmyPDF;
//Passing a single parameter with a value
OCRmyPDF::make('document_zh-CN.pdf')
->setParam('-l', 'chi_sim')
->run();
//Passing a single parameter without a value
OCRmyPDF::make('document_withBackground.pdf')
->setParam('--remove-background')
->run();
//Passing multiple parameters
OCRmyPDF::make('document_withoutAttribution.pdf')
->setParam('--title', 'Lorem Ipsum')
->setParam('--keywords', 'Lorem,Ipsum,dolor,sit,amet')
->run();