1. Go to this page and download the library: Download imal-h/pdf-box 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/ */
imal-h / pdf-box example snippets
use ImalH\PDFLib\PDF;
// From HTML String
PDF::init()
->driver(PDF::DRIVER_CHROME)
->convertFromHtml('<h1>Hello World</h1>', 'output.pdf');
// From URL (Coming Soon)
// PDF::init()->driver(PDF::DRIVER_CHROME)->fromUrl('https://google.com')->save('output.pdf');
use ImalH\PDFLib\PDF;
// Convert PDF Page 1 to JPEG
PDF::init()
->driver(PDF::DRIVER_GHOSTSCRIPT)
->from('document.pdf')
->to('output_folder')
->convert();
use ImalH\PDFLib\PDFLib; // Legacy Class
$pdfLib = new PDFLib();
$pdfLib->setPdfPath("document.pdf")
->setOutputPath("output_folder")
->convert();