小编Luí*_*ves的帖子

Wkhtmltopdf不呈现Chart.JS 2.5.0图

使用:
WKpdftohml版本0.12.3.2
PHPwkhtmltopdf版本2.2.0
Chart.JS版本2.5.0

我正在尝试使用上面的库打印折线图.我可以使用shell命令重现pdf:wkhtmltopdf --javascript-delay 5000 " http://netdna.webdesignerdepot.com/uploads7/easily-create-stunning-animated-charts-with-chart-js/chartjs-demo.html" test2.pdf
所以WKhtmltopdf没有问题.

问题是当我在我的应用程序中使用PHPwkhtmltopdf库时.我得到一个空白页面.
根据我的研究,这些是我尝试过的东西:

  • 添加'javascript-delay' => 500到Chart.JS选项;
  • 添加animation:{onComplete: function () {window.JSREPORT_READY_TO_START =true}到Chart.JS选项;
  • 添加<div style="width:800px;height:200;font-size:10px;">到canvas html标记的父div
  • 添加ctx.canvas.width = 800;ctx.canvas.height = 200;到图表的javascript初始化.

没有什么工作.我喜欢Chart.JS和WKhtmltopdf,但如果我不能打印,我将不得不放弃其中一个.有什么解决方案吗?

这是PHPwkhtmltopdf的PHP代码:

public function imprimir ($request, $response)
{
    // include_once 'config/constants.php';
    // include_once 'resources/auxiliar/helpers.php';

    $folha = $_POST['printit'];
    $variaveis = explode(',', $folha);

    $nomeFicheiro = $variaveis[0];

    $printName = substr($nomeFicheiro, 5);

    if (isset($variaveis[2])) {

        $_SESSION['mesNumero'] = $variaveis[2];
        $_SESSION['mes'] = $variaveis[1];

    } else {

        $mesNumero …
Run Code Online (Sandbox Code Playgroud)

chart.js phpwkhtmltopdf

4
推荐指数
3
解决办法
7380
查看次数

标签 统计

chart.js ×1

phpwkhtmltopdf ×1