This is an archived forum post. The information may be outdated. Contact us if you have any questions.

PDF Won't Generate

spyke01 wrote on 2010-10-16:
Hi Guys,
I have the API script set up on my server and have tried it with an actual report and with a simple text of "Test" but all I get is a blank page. CURL is installed on the server and is working but all I get is a blank page. Here's the code I am using:

<?
include('includes/classes/pdfcrowd.php');

$reportData = "Test";
$client = new Pdfcrowd('*MY_USERNAME*', '*MY_API_KEY*');
try {
    $client->convertHtml($reportData);
}
catch(PdfcrowdException $e) {
    echo $e->getMessage();
}

?>


Any idea what I can do to fix this?
support wrote on 2010-10-16:
Try this:

try {
    header('Content-type: application/pdf');
    header('Content-Disposition: attachment; filename="test.pdf"');
    echo $client->convertHtml($reportData);
}
spyke01 wrote on 2010-10-17:
That did it thanks!