Belphegor
Belphegor

Reputation: 1

convert graphic "google chart" to image

I'm working with google charts to generate graphical, I need to convert these graphics to images so that they can download, I've seen link:

http://bl.ocks.org/nverba/5411684

When downloaded the image as png, the image is recorded with a name that seems random and whitout extension, how can I do so that the image is recorded with. Png?

And in the browser skips the following error:

Error: [Exception ... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIAnnotationService.setPageAnnotation]" nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)" location: "JS frame :: resource :/ / app / modules / DownloadsCommon.jsm: : DownloadsDataCtor.prototype._updateDataItemState :: line 689 "data: no]

This java script does not work with older versions of browsers, any other alternative?

Upvotes: 0

Views: 154

Answers (2)

asgallant
asgallant

Reputation: 26330

Browsers do not support adding a file name to data URLs. If you want to give the images a proper file name, you have to send them to your server first, use the server to change the headers, and send the file back to the client.

The conversion to the .png image format requires SVG support in the browser. Browsers without SVG support (IE8 and older, primarily) will not be able to convert the charts to images.

Upvotes: 1

eltiburon
eltiburon

Reputation: 47

I checked out your link. If you hit the "convert to image" button a png appears on the right side. A right-click and the selection of "save as" will generate the wanted png.

Upvotes: 0

Related Questions