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

Cant save pdf file in any folder/directory after generate PDF

jitendra wrote on 2014-10-03:

Cant save pdf file in any folder/directory after generate PDF, i have used this code.

require 'pdfcrowd.php';

// create an API client instance
$client = new Pdfcrowd("myusername", "myAPI");

// convert a web page and store the generated PDF into a $pdf variable

$out_file = fopen("document.pdf", "wb");
$client->convertHtml("<head></head><body>My HTML Layout</body>", $out_file);

// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: max-age=0");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"google_com.pdf\"");

// send the generated PDF
echo $pdf;
catch(PdfcrowdException $why)
echo "Pdfcrowd Error: " . $why;
Its saving document.pdf but that size is 0KB and after open its giving me error message. i tried hard.
please someonce can help me. i really need it..

thanks in advance..
waiting some quick responce. Please help
jitendra wrote on 2014-10-05:
Is there anyonce can help me ???

i am expecting reply from support desk
support wrote on 2014-10-06:

According to our log you already used up all test tokens and the API returns an error which should be caught by the catch block in your code.

If you need more tokens for testing please let us know at support@pdfcrowd. Otherwise, if you wish to continue using our service, you can choose from the API plans here:
jitendra wrote on 2014-10-06:
I have sent a mail of support desk. so please check and give me some more tocken if possible.
also tell me why its not saving PDF file as i mention in 1 post.

Please reply me .
latheesh wrote on 2015-06-01:
Cant save pdf file in any folder/directory after generate PDF
support wrote on 2015-06-02:
Please make sure that your app is allowed to write to the target directory - this is the most common cause.