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

php web page with charts ( donut, morris etc), convert to pdf shows small size and stick to left side contents

sunnysehgalji wrote on 2018-03-19:
when i am using pdfcrowd api code below :-

<?php
require 'pdfcrowd-php/pdfcrowd.php';

try
{
// create an API client instance
$client = new Pdfcrowd("username", " api key ");
$client->setPageMargins("20mm", "20mm", "20mm", "20mm"); // <<< this is my addition line

$pdf = $client->convertURI('http://dev.cloudwifi.io/detailedAnalyticsHtml.php?iD=37&lang=fr');
// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: max-age=0");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"Analytics.pdf\"");

// send the generated PDF
echo $pdf;

}
catch(PdfcrowdException $why)
{
echo "Pdfcrowd Error: " . $why;
}
?>


NOTE:- what happened that my php web page containing some charts ( donut , morris etc ), when page converted to pdf file, the text of the page is small and lean to left hand side, i m also attached my pdf file
support wrote on 2018-03-19:
Hi,

Our Stable API has some issues with charts.

Could you please try the new version of our API to see if it resolves your issue?
The new version is currently in beta and it is free to use.

You can activate access to the new API here:
-- https://pdfcrowd.com/user/account/api2-license/

You need to install the latest PHP client library:
-- https://pdfcrowd.com/api/client-library/php/

Update your code according to the new documentation because new API has somewhat different syntax:
-- https://pdfcrowd.com/api/html-to-pdf-php/