Skip to main content

Quick Start for PHP

While wkhtmltopdf is widely used in PHP, and Puppeteer support exists via workarounds, our solution offers faster HTML to PDF conversion without extra dependencies. Here’s how to start with PHP.

Get Your API Key

  • After signing up, you can find your API Key in the Admin Dashboard or the welcome email.
  • This key is crucial for authorizing all API interactions.

Make Your First Request

Follow the example provided below to initiate a request to the PDFBolt API and effortlessly generate your first PDF.

<?php

$ch = curl_init('https://api.pdfbolt.com/v1/direct');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'API_KEY: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['url' => 'https://example.com']));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

file_put_contents('example.pdf', $response);

?>

What’s next?

Continue your journey with PDFBolt by exploring its extensive features and benefits. Start by checking the available API Endpoints and reviewing the various Conversion Parameters that can be used to customize your integration. This will help you leverage PDFBolt’s full capabilities and ensure that it aligns with your specific requirements.