How can I create PPT readable XML from JavaScript (browser)? - javascript

I have an app where users create designs that they can then export to SVG via JS.
Unfortunately, SVG is mostly incompatible with PPT and I need to create a separate export format.
How should I export graphical data to a PowerPoint format?
I tried pptxgenjs, but there isn't enough flexibility there.
Is there a single XML file I can export (similar to SVG) that is readable by powerpoint?

Related

Exporting multiple graphs (SVG) to PDF

I'm trying to export multiple graphs (fusion charts XT - rendered as SVG format in web page) to PDF. I learnt fusion charts isn't providing any feature for Javascript graphs. I search for multiple dlls. Finally tried working with jsPDF.js as well as svg_to_pdf.js - but when it comes to rendering multiple graphs - not sure how to proceed. Is there any example online for downloading multiple svg images in a web page to pdf? Please suggest.
Do you have multiple graphs on the same page and want to export them all into one PDF?
If yes, then you can probably consider converting those SVGs into multiple image streams (base64 encoded) using canvas, pass them to the server side, and the server can generate a PDF file containing those image streams.
We have used this method in our own application and I hope it can help you, too.

Is there anyway to export D3 JS graphs into LaTeX tikz graphs programmatically?

There are many ways of exporting R graphs and R Tables quickly into LaTeX using the R tikzDevice (on the R side) and the LaTeX tikz package (On LaTeX side). Have a look at this blog article for more info.
Are there any automated method or JS library similar to the above concept but transforms a complete visualization in D3.JS to native LaTeX TiKz like graphs. I need that to include good resolution graphs into LaTeX papers and reports.
I know that there many ways and JS code that export visualization into PNG, JPEG, PDF etc... Is there any easy way to export D3.js into TikZ LaTeX?
Thanks for any suggestions.
Not tested but pretty sure you could go: d3js->SVG->TikZ
Export from d3 to SVG, e.g
d3.select(this)
.attr("href", 'data:application/octet-stream;base64,' + btoa(d3.select("#graph").html()))
.attr("download", "graph.svg")
Convert SVG to TikZ (SVG2TikZ, etc).
Import TikZ into LaTeX
If this process works you could easily automate it using python.
I know that there many ways and JS code that export visualization into
PNG, JPEG, PDF etc...
My thinking is that if you can't go direct - then to try and use one of the many ways as an intermediate format (in this case SVG) to get the data from one to the other.

Can I load .gml in d3?

I saved a .gml from wolfram mathimatica, does anyone have an example of how to load the file and display on a webpage? I am dealing with d3 at the moment, would another language be more appropriate?
Thanks.
There's a really good post on exactly this at one developer's blog.
The gist of it is that D3, even in its latest version (v4, at the time of writing this), can't import GML files. However, you can convert a GML file into a JSON file, which D3 can read. You can use NetworkX for this conversion.
Alternatively, you may use Gephi to export the edges and nodes to CSV separately.

Style data and Export it to XLS/CSV/PDF using javascript

I have been searching a way to export data to xls/csv/pdf and found many threads talking about this topic:
Angular JS - How to export Javascript Object to XLS file ?
Export to xls using angularjs
However, none of these methods support styling data; text color, background color, regular/bold/italic, etc. For example, I wanted to style a header row background of a xls file to be gray. Moreover, most of them don't support in Safari/IE9.
Is there any library for exporting these types of data, which support styling data and also support all modern browsers?
For styling you need to use other available API's/.jar files
Apache POI for Excel
IText for PDF
I doubt if any JS file provide support for designing Excel and PDF.
You should take a look at the Microsoft Office XML Formats here (https://en.wikipedia.org/wiki/Microsoft_Office_XML_formats)
You can construct a variable with the xml tags, then output it as XLSX.

How to export an image or PDF from a Processing Javascript mode sketch?

Processing 2 'Java mode', previously known as 'standard mode', has some easy options to output graphics like
saveFrame() or the PDF Export Library.
Now, the web friendly 'Javascript mode' (based on the Processing.js project) allows one to host a sketch easily (by way of HTML canvas), but I can't find much about file output when using it.
How can I make my 'Javascript mode' sketch save SVG or PDF?
(Unfortunatly I don't know Javascript, so the answer might not assume knowledge of it)
The javascript mode of Processing utilizes HTML5 Canvas by default for rendering. You can use the HTML5 toDataURL method of canvas in order to export a PNG.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement
In fact, that is what save() and saveFrame() do in Processing.js. If you look throug the reference in Processing.js you'll notice that the functions you would use to export PDF in Processing are unavailable (indicated by red).
Exporting to PDF from canvas does not seem possible. However, there are a few frameworks that export canvas to SVG. It has been asked here before as well.
Here is an extensive study for going from SVG to canvas and back again. Towards the bottom there is an excellent roundup of toolkits you can use. However, mixing these in with Processing.js is non-trivial.
If you don't know Javascript well and you need to export to PDF or SVG in Javascript and not Java then I would suggest one of these other toolkits. Here is a great page that shows the basics of getting started on Processing.js vs Paper.js vs Raphael. You'll notice that is isn't too different, if you know Processing then you should be ok.
Processing.js can also render to WebGL but that doesn't have either an SVG or PDF export option natively or through any toolkit that I know of.

Categories

Resources