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

Pdfcrowd Error : [502] Sorry, we couldn't process your request.

buzzea wrote on 2013-03-29:
I'm trying to convert this page : http://simpledad.fr/verbaudet/
into PDF using the API in PHP.


I have an error : [502] Sorry, we couldn't process your request.
Although i haven't error using the form on https://pdfcrowd.com/

And others URLs (other than http://simpledad.fr/verbaudet/) works fine.

My source code is :

___________________________________________
try {
$client = new Pdfcrowd($pdfApiLogin, $pdfApiToken);
$numTokens=$client->numTokens();

if($numTokens>0){
$client->setPageWidth('210mm');
$client->setPageHeight(-1);
$client->setFooterHtml('<div style="font-size:12px; color:#333; font-family:Arial, Helvetica, sans-serif; background-color:#CCC; text-align:center;">Converti en PDF &agrave; partir de <a href="%u">%u</a> le '.date("d/m/Y H:i:s").'</div>');
$client->setHeaderHtml('<div style="font-size:12px; color:#333; font-family:Arial, Helvetica, sans-serif; background-color:#CCC; text-align:center;">Converti en PDF &agrave; partir de <a href="%u">%u</a> le '.date("d/m/Y H:i:s").'</div>');
$client->enableJavaScript(false);
$client->setInitialPdfZoomType(1); // FIT_WIDTH
if($pdf = $client->convertURI($urlToConvert)){
$fp = fopen($chemin.$nomDuPdf, 'w');
fwrite($fp, $pdf);
fclose($fp);
chmod($chemin.$nomDuPdf,0777);
echo "PDF saved on ".$chemin.$nomDuPdf."<br>";
} else {
echo "this URL is not available";
}
} else {
echo "not enought credits";
}
}catch(PdfcrowdException $why){
echo "Error converting to PDF : " . $why;
}
___________________________________________


Could you help me ?
support wrote on 2013-04-01:
Hello,

Try to add the following line before the convertURI() call:
$client->setHtmlZoom("100");

Does this help?
buzzea wrote on 2013-04-02:
it works.
thank you