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

unable to generate pdf

sachinsk wrote on 2013-01-03:
Hi,
I am using pdfcrowd api and not able convert html to pdf.
Its displaying error like ->Pdfcrowd Error: Writing the PDF file failed. The disk may be full.
Please help me
Thnx in advance
paddyz wrote on 2013-01-03:
Try to chmod the folder to 777 or check that www-data is the owner.

The error message appears if the pdf could not be created.
sachinsk wrote on 2013-01-03:
No,its not working.
I have changed the permission..
support wrote on 2013-01-03:
Try to add the following line before you call the API:
set_magic_quotes_runtime(false);

Does this help?
sachinsk wrote on 2013-01-04:
No,still i am getting same error.
support wrote on 2013-01-05:
To diagnose the problem, it would help if you could run

$client = new Pdfcrowd("***", "***");
$pdf = $client->convertURI("http://pdfcrowd.com/ping/");
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"$filename.pdf\"");
echo $pdf;


and then

$client = new Pdfcrowd("***", "***");
$pdf = $client->convertURI("http://pdfcrowd.com/ping/");
$out_file = fopen("/path/to/dir/ping.pdf", "wb");
$written = fwrite($out_file, $pdf);
fclose($out_file);
$pdf_length = strlen($pdf);
echo "$pdf_length, $written\n";


The first script sends PDF to the browser, the second saves it to "/path/to/dir/ping.pdf" (replace this with a real path). Please send us both PDF files and also the echoed output of the second script.