自定义消息显示在amchart pdf下载文件中

时间:2016-12-07 06:06:53

标签: javascript amcharts

我正在使用amchart 3.16版。我需要在amchart下载的pdf图像中显示自定义消息,而不是显示“已保存自:url”。 如何在下载的文件中包含自定义消息? 代码是这样的。

"menu": [ {
                        "label": "Download",
                        "menu": [
                            { "label": "PNG",
                                click: function() {
                                    this.capture({},function() {
                                        this.toPNG( {}, function( data ) {
                                            this.download( data, "image/png", fileName+'.png');
                                        });
                                    });}},

                            { "label": "JPG",
                                click: function() {
                                    this.capture({},function() {
                                        this.toJPG( {}, function( data ) {
                                            this.download( data, "image/jpg", fileName+'.jpg');
                                        });
                                    });}},

                            { "label": "SVG",
                                click: function() {
                                    this.capture({},function() {
                                        this.toSVG( {}, function( data ) {
                                            this.download( data, "text/xml", fileName+'.svg');
                                        });
                                    });}},
                            { "label": "PDF",
                                click: function() {
                                    this.capture({},function() {
                                        this.toPDF( {}, function( data ) {
                                            this.download( data, "application/pdf", fileName+'.pdf');
                                        });
                                    });}}]

                    },
                    {
                        "label": "Save as..",
                        "menu": [ { "label": "CSV"},
                            { "label": "XLSX"}
                        ]

                    },
                    {
                            "label": "Print",
                            "format":"PRINT"
                        },
                        { "label": "Annotate",
                            "action": "draw",
                            "drawing":
                            {
                                "fontSize": 30
                            }
                        }]

2 个答案:

答案 0 :(得分:0)

export.js 中,您可以更改以下代码...

["Saved from:", window.location.href, {image: "reference", fit: [523.28, 769.89]}]

这一个:

[{image: "reference", fit: [523.28, 769.89]}]

答案 1 :(得分:0)

在export.js中,您可以根据需要注释/更改以下代码...

if ( cfg.pageOrigin ) {
                    pageContent.push( _this.i18l( "label.saved.from" ) );
                    pageContent.push( window.location.href );
                    pageDimensions[ 1 ] -= ( 14.064 * 2 );
                }

=============================================== =========================