Skip to content

zielinskila/php-pdftoppm

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-pdftoppm

Build Status Scrutinizer Code Quality

PHP wrapper for the pdftoppm command which is part of poppler-utils.

The Pdftoppm is a library that handles conversion of PDF files to images. It is available on variety of systems.

Available packages: http://pkgs.org/download/poppler-utils

Usage

use Wb\PdfToPpm\PdfToPpm;
$pdfToPpm = PdfToPpm::create();
// $result is an instance of \FilesystemIterator
$result1 = $pdfToPpm->convertPdf('path/to/pdf');
$result2 = $pdfToPpm->convertPdf('path/to/pdf', 'path/to/other/destination/dir/then/tmp');

// Save as png
$result3 = $pdfToPpm->convertPdf('path/to/pdf', 'path/to/other/destination/dir/then/tmp', true);

// Set specific resolution
$result4 = $pdfToPpm->convertPdf('path/to/pdf', 'path/to/other/destination/dir/then/tmp', true, 300);

// Set filename (skips generating random directory),
// 'ExampleFileName' will return 'ExampleFileName-1.png', 'ExampleFileName-2.png' files.
$filename = 'ExampleFileName';
$result5 = $pdfToPpm->convertPdf('path/to/pdf', 'path/to/other/destination/dir/then/tmp', true, 300, $filename);

Testing

cp phpunit.xml.dist phpunit.xml

Change the phpunit.xml env binary directive if necessary.

composer install
php vendor/bin/phpunit

About

PHP wrapper for pdftoppm

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%