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

API gives different result

bengladwell wrote on 2014-05-13:
If I use the web form on to generate a PDF for this page, it generates without problems.

If I use the API (PHP lib) to generate the PDF, it has a couple errors. On page 14, there are two blocks that do not appear. A <section class="pastetable link section"> block under the Top Referers By Visit / Top Refers By Sales header and a <div class="linktable"> block under the Top 100 Domains Linking to Site header. Neither of these tags use page-break-before, but if I remove page-break-before from all elements on the page, the missing blocks appear in the generated PDF.

I am calling the API like this:
$pdf = $client->convertURI($url);

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

echo $pdf;

I am using version 2.7 of the PHP lib.

The generated PDF is 500 KB, so I cannot attach it.

Thank you for your help.
support wrote on 2014-05-14:

I'm not sure why, but it seems this is related to the PDF page width. The elements you refer to do not come up in A4 portrait but they are printed correctly in A4 landscape. Could you try to add the following lines before convertURI() to see if helps?
bengladwell wrote on 2014-05-14:
Thanks! Explicitly setting the page size fixed it.