dsd57259 2013-04-19 17:07
浏览 267

wkhtmltopdf - 将AJAX创建的SVG转换为PDF

I am working on an application that converts HTML and SVG charts, generated with d3.js, to PDF. The charts are rendered through AJAX calls after the page loads.

I am working with wkhtmltopdf 0.9.6 which seems to do a great job converting static HTML5 to PDF, but I am having problems converting the SVG charts.

When rendering a simple multi series line chart, most of the chart area is not rendered. Even after disabling animations. Using the --redirect-delay doesn't help even when set to 8000.

What's interesting is that most that parts of the chart are rendered, like the legend and axis. Just not the content.

Anyone else encountered this or a similar problem?

Thank you.

  • 写回答

2条回答 默认 最新

  • duanchuli5647 2014-06-05 20:04
    关注

    add last page this script:

    function sleep(milliSeconds) {
        var startTime = new Date().getTime(); // get the current time
        while (new Date().getTime() < startTime + milliSeconds); // hog cpu
    }
    
    sleep(5000);
    

    And: --redirect-delay -> 5000

    Use library d3.js no compress other js.

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看