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

Getting a 502 Error with HTTP Api

automatedme wrote on 2010-05-06:
Hi,

I am experimenting around with the api. I think I have everything posting correctly, but I get a 502 response back.

502 Bad Gateway

The server returned an invalid or incomplete response.

Here is my test form

<form id="pdfCrowdForm" action="http://pdfcrowd.com/api/pdf/convert/uri/" method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" id="username" name="username" value="myusername" />
<input type="hidden" id="key" name="key" value="mykey" />
<input type="hidden" id="width" name="width" value="13.9" />
<input type="hidden" id="height" name="height" value="-1" />
<input type="text" id="src" name="src" />
<fieldset>
<button class="red button" value="Download" >Download PDF</button>
</fieldset>
</form>

Any Ideas?
support wrote on 2010-05-06:
It seems that the problem is caused by the height field set to -1. A positive value should work. That -1 is an experimental feature which sometimes yields unexpected results. We will likely remove it unless people really want it.

Also note that the page dimensions must be specified in points (1/72 of an inch) so in your case you should set the width field to 1000 instead of 13.9.
automatedme wrote on 2010-05-06:
Thanks for the quick reply. That feature is actually the exact feature that I am using pdfcrowd for (I was using pdfmyurl before). So I would vote to keep it. I like not having the images of a web page broken by pages when looking at the pdf. For my purposes, most sites will be only a few pages long, so I can experiment with different positive values and see how that works.

Vote 1 for keeping the -1 feature, though, I love it.

Thanks again.
automatedme wrote on 2010-05-07:
As it turns out, it was using 13.9 for the width that caused the problem. Leaving off the width or using a value like 1000 and setting height to -1 works great. Thanks for the help.
support wrote on 2010-05-07:
Thanks for your feedback. We have updated the service so that it should not return 502 for small values now. We also improved the 'single page' feature a bit so it might give you better results in some cases.