Skip to main content

Quick Start for PHP

While wkhtmltopdf is commonly used in PHP and Puppeteer support is available through workarounds, PDFBolt provides a faster and more efficient solution for HTML to PDF conversion without requiring additional dependencies.

1️⃣ Get Your API Key

  • After signing up, locate your API Key in the Admin Dashboard or the welcome email sent upon registration.
  • This key is essential for authenticating your requests to the PDFBolt API. Remember to keep it secure.

2️⃣ 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);

?>

3️⃣ What’s next?

Discover how PDFBolt can enhance your workflows. Begin with the API Endpoints and explore the Conversion Parameters to customize your setup and meet your specific needs.