This is an archived forum post. The information may be outdated. Contact us if you have any questions.
curl -v -u 'support_westerndeal:your-api-key' -F text='hello world' -o test.pdf http://api.pdfcrowd.com/convert/
<?php require 'pdfcrowd.php'; try { // create the API client instance $client = new \Pdfcrowd\HtmlToPdfClient("support_westerndeal", "your api key"); // create output file for conversion result $output_file = fopen("/tmp/test.pdf", "wb"); // run the conversion and store the result into a pdf variable $pdf = $client->convertString("hello world"); // write the pdf the into the output file fwrite($output_file, $pdf); // close the output file fclose($output_file); } catch(\Pdfcrowd\Error $why) { // report the error error_log("Pdfcrowd Error: {$why}\n"); error_log("Pdfcrowd Error Code: {$why->getCode()}\n"); error_log("Pdfcrowd Error Message: {$why->getMessage()}\n"); // handle the exception here or rethrow and handle it at a higher level throw $why; } ?>