PHP code example of ztomesic / pdfextractor

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

    

ztomesic / pdfextractor example snippets


$file = new PDF('/file/location/file.pdf');

PDFExtractor::burst($file)->save('/location/where/to/burst/');


PDFExtractor::cat(/location/of/pdf/files/, '*.pdf')->save('location/where/to/save/', 'name_of_new_file.pdf');


$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::PDFToText($pdf);


$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::searchPDF($pdf, 'wordToSearchBy');


$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::rebuildPDFByKeyword($pdf, '/location/where/to/burst/', '/location/where/to/rebuild/', 'keyword_to_rebuild_by');


$pdf = new PDF('/file/location/file.pdf');

PDFExtractor::relocateFile($pdf, '/new/file/path/');


$excludedFiles = ['excluded_file.pdf'];

PDFExtractor::clearFolder('/path/to/directory/', $excludedFiles);


PDFExtractor::removeDirectory('/path/to/directory/');


PDFExtractor::createDirectory('/path/to/directory/name/');


$pdf = new PDF('/file/location/file.pdf');
$PDFExtractor = PDFExtractor::burst($file)->save('/location/where/to/burst/');

$PDFExtractor->searchMultiplePDFByKeywords('/location/where/to/burst/', 'wordToSearchBy')
             ->changeFileLocation('/location/where/to/rebuild/')
             ->mergePDFByKeywords();


PDFExtractor::extractMetadata('/path/to/directory/name/')
    ->save('/location/where/to/save/', 'name_of_file.txt')
    ->toArray();


PDFExtractor::extractMetadata('/path/to/directory/name/')
    ->save('/location/where/to/save/', 'name_of_file.txt')
    ->toString();