如何发布Highcharts图片? [英] How to POST Highcharts Image?

查看:122
本文介绍了如何发布Highcharts图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个包含Highcharts.js图表​​的PDF文件,只是想知道是否有一种方法可以优化Export模块以将图像(png或jpeg)发布到我要创建PDF文件的PHP文件中在那里.

I need to create a PDF file which contains Highcharts.js chart and just wondering if there is a way to optimize the Export module to POST the image (png or jpeg) to a PHP file which I want to create the PDF files there.

如您所知,导出模块通常将输出导出为可下载文件,但我不想下载它们,只需将其发送到服务器即可.

As you know the exporting module normally exports the output as downloadable files but I do not want to download them just send them on the server.

谢谢

推荐答案

您可以将highchart的导出模块与 TCPDF 一起使用图书馆. TCPDF 库支持svg冒险.

You can use highchart's exporting module along with TCPDF Library. The TCPDF library Support svg rendaring.

您可以使用exportApi

You can use the exportApi

   chart.exportChart({
             url : 'export.php',
             filename: 'my-chart'
        }); 

然后使用示例脚本来自原始代码的主要部分是

$pdf->ImageSVG期望第一个参数为string SVG文件的名称或一个'@'字符,后跟SVG数据字符串.

$pdf->ImageSVG expect first parameter as string Name of the SVG file or a '@' character followed by the SVG data string.

$ pdf-> ImageSVG("@".$ _ POST ['svg'],$ x = 15,$ y = 30,$ w = 200);

$pdf->ImageSVG("@".$_POST['svg'], $x=15, $y=30, $w=200);

编码愉快!

注意:您需要下载TCPDF库

这篇关于如何发布Highcharts图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆