Javascript 导入export.js(导出highchart图表)时出现错误“无法读取未定义的”属性“文档”

Javascript 导入export.js(导出highchart图表)时出现错误“无法读取未定义的”属性“文档”,javascript,highcharts,Javascript,Highcharts,我正在尝试将highchart图表导出为PDF文件。为此,我读到应该使用export.js和其他库。但是当我导入这个library exporting.js时,我得到一个错误:“无法读取未定义的属性‘document’” 我从一个javascript文件导入此文件: var newscript = document.createElement('script'); newscript.type = 'text/javascript'; newscript.async = true; newscr

我正在尝试将highchart图表导出为PDF文件。为此,我读到应该使用export.js和其他库。但是当我导入这个library exporting.js时,我得到一个错误:“无法读取未定义的属性‘document’”

我从一个javascript文件导入此文件:

var newscript = document.createElement('script');
newscript.type = 'text/javascript';
newscript.async = true;
newscript.src = '/resources/tda-ga/js/charts/lib/exporting.js';
(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript);

我将感谢任何帮助

请验证export.js和highcharts.js模块的版本是否相同。看起来您引用的是最新的export.js,而不是最新的highcharts.js。

请验证您是否拥有相同版本的export.js和highcharts.js模块。看起来您指的是最新的exporting.js,而不是最新的highcharts.js。我使用了exporting.js的旧版本,一切正常!非常感谢。