Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将图表列表图表导出为pdf文档(jspdf)_Javascript_Pdf_Jspdf_Chartist.js - Fatal编程技术网

Javascript 将图表列表图表导出为pdf文档(jspdf)

Javascript 将图表列表图表导出为pdf文档(jspdf),javascript,pdf,jspdf,chartist.js,Javascript,Pdf,Jspdf,Chartist.js,我的情况是,我需要使用jspdf将图表输出到javascript生成的pdf文档中 我想转换显示在我的网站上的图表 我正在使用ChartList进行此操作 有什么方法可以做到这一点吗?您可以查看jsPDF的addHTML函数,它应该为您提供画布的干净副本 const pdf = new jsPDF('p','pt','a4') const chartistChart = document.getElementById('your-chartist-chart') const previewPan

我的情况是,我需要使用jspdf将图表输出到javascript生成的pdf文档中

我想转换显示在我的网站上的图表
我正在使用ChartList进行此操作


有什么方法可以做到这一点吗?

您可以查看jsPDF的addHTML函数,它应该为您提供画布的干净副本

const pdf = new jsPDF('p','pt','a4')
const chartistChart = document.getElementById('your-chartist-chart')
const previewPane = document.getElementById('preview-pane')

// addHTML is marked as deprecated, see links below for further information
pdf.addHTML(chartistChart, function() {
    // Get the output pdf data URI
    const outputString = pdf.output('datauristring')
    // Changes the src to new data URI
    previewPane.attr('src', outputString)
})
  • Github上有关弃用和未来更改的问题