Inkspan › PHP
Call the Inkspan /v1/generate/html endpoint from PHP to generate a PDF from HTML — no headless browser, fonts, or PDF infrastructure to maintain. Set your API key as an environment variable and POST.
// PHP
$ch = curl_init('https://api.inkspan.dev/v1/generate/html');
curl_setopt_array($ch, [CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => 1,
CURLOPT_HTTPHEADER => ['X-API-Key: '.getenv('INKSPAN_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"html":"<h1>Invoice</h1>"}']);
file_put_contents('out.pdf', curl_exec($ch));
Get a free API key →