【问题标题】:Symfony KNP Snappy Bundle: The process has been signaled with signal "11"Symfony KNP Snappy Bundle:进程已用信号“11”发出信号
【发布时间】:2020-03-10 23:11:52
【问题描述】:

我使用 KNP snappy bundle 创建了一个带有 highcharts 图表的 PDF。如果我做 getOutputFromHtml(),渲染没有 highcharts 图表的树枝文件,它是成功的。如果我从 highcharts 复制并粘贴示例,然后 getOutputFromHtml(),则成功。所以它不是 WKHTMLTOPDF、highcharts 或导致问题的 javascript 的路径。如果我用我想去那里的图表从 highcharts 中切换示例,那么它会引发错误“进程已通过信号“11”发出信号。”。我在网站的其他页面上有图表,它不会引发任何 javascript 错误,所以它不是图表。如果我在 getOutputFromHtml() 之前查看 twig 文件中的 html 渲染,则图表正在显示并且不会引发任何 javascript 错误。我将动画、启用鼠标跟踪和阴影都设置为 false。只有当我缩短数据系列的名称或更改数据系列最后一项的 y 时,流程错误才会消失。我查看了具有相同错误的其他问题,但没有一个能解决我的问题。我还验证了 selinux 不是导致问题的原因。

这是图表

<script type="text/javascript">
        $(document).ready(function () {
            Highcharts.chart('tam-by-product-type-chart', {
                credits:{
                    enabled:false
                },
                chart: {
                    plotBackgroundColor: null,
                    plotBorderWidth: null,
                    plotShadow: false,
                    type: 'pie'
                },
                title: {
                    text: 'TAM by Product Type'
                },
                tooltip: {
                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                },
                accessibility: {
                    point: {
                        valueSuffix: '%'
                    }
                },
                plotOptions: {
                    pie: {
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: true,
                            format: '<b>{point.name}</b>: {point.percentage:.1f} %'
                        }
                    }
                },
                series: [{
                    name: 'Share',
                    enableMouseTracking: false,
                    shadow: false,
                    animation: false,
                    data: [{
                        name: 'Addressable Wire/Cable',
                        y: {{ data.totalProductTypes.wireCable|number_format(2) }}
                    }, {
                        name: 'Addressable Lighting',
                        y: {{ data.totalProductTypes.lighting|number_format(2) }}
                    }, {
                        name: 'ACRF',
                        y: {{ data.totalProductTypes.conduitRacewayFittings|number_format(2) }}
                    }, {
                        name: 'ADSCB',
                        y: {{ data.totalProductTypes.distributionSwitchgearCircuitBreakers|number_format(2) }}
                    }, {
                        name: 'AIC',
                        y: {{ data.totalProductTypes.industrialControls|number_format(2) }}
                    }, {
                        name: 'All Other',
                        y: {{ data.totalProductTypes.other|number_format(2) }}
                    }]
                }]
            });
        });
    </script>

这是我制作pdf的地方

$bodyHtml = $this->templating->render('pdf/reports/territory_book/body.html.twig', array('data' => $data));

$bodyPdf = $this->pdf->getOutputFromHtml($bodyHtml, array(
    'page-size' => 'Letter',
    'images' => true,
    'enable-javascript' => true,
    'javascript-delay' => 5000
));

【问题讨论】:

  • 嗨@Chelsea,所以问题可能是由您的数据引起的。 y 属性的示例值是什么?
  • @ppotaczek 感谢您的回复!这不是数据。这个数据相同的图表显示在其他页面上没有错误。如果我使用示例数据,我仍然会收到流程 11 错误,因为如果是系列数据名称。
  • 请尝试以不同的方式定义数据:jsfiddle.net/BlackLabel/6m4e8x0y/4906

标签: symfony highcharts wkhtmltopdf snappy


【解决方案1】:

它最终成为图表上的字体大小。我将字体大小减小到 5,它生成的 pdf 没有错误。

dataLabels: {
     style: {
          fontSize: 5
     }
},

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-12-25
    • 2015-01-31
    • 1970-01-01
    • 2016-01-13
    • 2018-11-23
    • 1970-01-01
    • 2016-09-04
    • 2020-01-22
    相关资源
    最近更新 更多