1. Go to this page and download the library: Download owly-digital/pdf-api-client 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/ */
owly-digital / pdf-api-client example snippets
use Owly\PdfApiClient\PdfApiClient;
$client = new PdfApiClient('token');
$pdfFiles = [
'path/to/1.pdf',
'path/to/2.pdf',
];
// Basic conversion with automatically detected quality and printable resolution
$convertedFiles = $client->convertPdfFiles($pdfFiles, 'jpg');
// With custom quality and resolution
$convertedFiles = $client->convertPdfFiles($pdfFiles, 'jpg', 50, 300);
// Conversion to webp with custom resolution (default quality)
$convertedFiles = $client->convertPdfFiles($pdfFiles, 'webp', null, 300);
foreach ($convertedFiles as $name => $file) {
file_put_contents('/path/' . $name, base64_decode($file));
}
$html = "<html><body><h1>Look At Me, I'm PDF now!</h1></body></html>";
// $pdf can be directly forwarded for download
$pdf = $client->convertHtmlToPdf($html);
// or with custom filename
$pdf = $client->convertHtmlToPdf($html, 'awesomePdfFile.pdf');