php - 在 Laravel 8 中将图表刀片视图转换为 pdf
问题描述
我想将波纹管刀片视图转换为 pdf 文档。
刀片视图包含 Canvasjs 图表。我导出刀片视图时的标题和段落正常显示。但只有图表没有显示。
<!DOCTYPE HTML>
<html>
<head>
<script>
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
theme: "light2",
title:{
text: "Gold Reserves"
},
axisY: {
title: "Gold Reserves (in tonnes)"
},
data: [{
type: "column",
yValueFormatString: "#,##0.## tonnes",
dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
}]
});
chart.render();
}
</script>
</head>
<body>
<div id="chartContainer" style="height: 370px; width: 100%;"></div>
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
</body>
</html>
public function build()
{
$pdf = FacadesPdf::loadView('Mails.myTestMail',["details"=>$this->details]);
return $this->subject('Mail from UVARA ROI CALCULATOR.')
->attachData($pdf->output(),'report.pdf')
->view('Mails.myTestMail');
}
我正在后端级别转换它,我知道我可以使用 javascript 来制作它,但我想动态生成视图并导出为 pdf 并通过电子邮件发送。
提前致谢。
解决方案
推荐阅读
- java - 将对象列表保存到数据库,但如果一条记录失败,请继续使用 jpa spring boot
- azure - 当 microsoft AD 图快到 EOF 时使用 Azure 资源管理器
- android - 如何向 PagingDataAdapter 提交非 pagingData(只是对象列表)?
- python - Opencensus Python gRPC 的“异常迭代请求”
- c - Sprintf 正在连接值
- java - 在一维战舰游戏Java中实现第二艘船
- postgresql - 如何使用 Postgres 创建 trigram 或 ngram 单词
- node.js - Vercel.com 托管:开发和生产 URL
- javascript - 仅在子组件中使用道具是不好的做法吗?没有自己状态的子组件
- c - 在 C 中将 uint_8* 转换为任何类型,比如“double”或结构?