Welcome! Log In Create A New Profile

Advanced

PDF Won't Generate

Posted by spyke01 
PDF Won't Generate
October 16, 2010 11:28AM
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?
Re: PDF Won't Generate
October 16, 2010 12:42PM
Try this:

try {
    header('Content-type: application/pdf');
    header('Content-Disposition: attachment; filename="test.pdf"');
    echo $client->convertHtml($reportData);
}
Re: PDF Won't Generate
October 17, 2010 05:35PM
That did it thanks!
Sorry, only registered users may post in this forum.

Click here to login