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

canvas elements are not printed in pdf

tariq_mahmood wrote on 2013-12-11:
I am using a jquery plugin jqplot to create charts but those charts are not printed to PDF. However if I use your online tool charts are printed fine. Simple steps to reproduce the issue are.

1. Go to http://pdfcrowd.com/
2. Select "Convert Web Page" tab and enter following url and click convert to pdf "http://www.jqplot.com/tests/line-charts.php"
3. Observe that pdf is generated with charts printed in it.
4. But when same thing is done with API using convertURI("http://www.jqplot.com/tests/line-charts.php") charts are not printed into pdf.

Sample Code

// create an API client instance
$client = new Pdfcrowd("username", "apikey");

// convert a web page and store the generated PDF into a $pdf variable
$pdf = $client->convertURI('http://www.jqplot.com/tests/line-charts.php');

// set HTTP response headers
header("Content-Type: application/pdf");
header("Cache-Control: no-cache");
header("Accept-Ranges: none");
header("Content-Disposition: attachment; filename=\"test.pdf\"");

// send the generated PDF
echo $pdf;
support wrote on 2013-12-12:
Hello,

That's strange, I tried your code and the charts are printed to PDF correctly. If you can send me a link where I can reproduce the issue, I will take a look at it.
tariq_mahmood wrote on 2013-12-12:
I am not sure what was the issue however I cleaned my html and remopved some inline styles and got pdf generated, but when file is downloaded it will not open with Adobe Reader it gives message "Adobe Reader could not open blah blah blah......".

Adobe Reader Version: X
Note: Size of downloaded file is 277 KB.

One more issue

Instead of downloading file I displayed it in browser. by using

header("Content-Disposition: inline; filename=\"test.pdf\"");

File is displayed fine in Firefox, but will not be displayed in Chrome or IE.

Chrome Version: 17.0.963.56 m
IE Version: 8

In Chrome it says Failed to load PDF document.
In IE when trying to view file an alert appears "File doesnot begin with '%PDF-'......"
support wrote on 2013-12-13:
Hello,

This indicates that your app echoes some output before the "echo $pdf" line. If you can post here a link to your pdf generation app, I will take a look at it.
tariq_mahmood wrote on 2013-12-17:
sorry for late reply, actually there was an echo statement before echo $pdf. thank you