This sample code demonstrates how to convert HTML to PDF in PHP using ByteScout Cloud API (low level).
Check other articles to learn how to convert HTML to PDF in Java, JavaScript and jQuery using Cloud API.
https://api.pdf.co/v1/pdf/convert/from/html
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure API key authorization: api_key Bytescout\Client\API\Configuration::getDefaultConfiguration()->setApiKey('x-api-key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Bytescout\Client\API\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-api-key', 'Bearer'); $api_instance = new Swagger\Client\Api\DefaultApi(); $text = ; // Text | HTML data to convert to PDF. $name = name_example; // String | File name for the generated result. try { $result = $api_instance->pdfConvertFromHtmlPost($text, $name); print_r($result); } catch (Exception $e) { echo 'Exception when calling DefaultApi->pdfConvertFromHtmlPost: ', $e->getMessage(), PHP_EOL; } ?>
IMPORTANT:
Cloud API is deprecated and was replaced with more powerful and secure www.PDF.co Web API
CLICK HERE
TO LEARN MORE
ABOUT NEW
www.PDF.co
w/ Web API
On-Premise API Server
Cloud API Server