Converting dynamic JavaScript content into static assets
One working solution is to use Browser Automation to generate static content from dynamic content. This has multiple uses such as for:
This works in Tiki21
for Diagram and is easy to deploy all over Tiki.
This is to brainstorm on how to handle images generated via JavaScript in mPDF. It is possible to generate server-side graphs from table data with JPGraph: http://mpdf1.com/manual/index.php?tid=364
However, the trend is to use JavaScript to generate fancy charts, with http://d3js.org/
offering a fantastic amount of possibilities.
Even if some things can't ultimately be done by mPDF, we should have some community solutions using other software. Having static images (ex.: png) is useful for inclusion in PDFs but also to send via email.
Examples of images to print
- http://demo.bpmn.io/s/pizza-collaboration
- https://github.com/mbostock/d3/wiki/Gallery
- https://google-developers.appspot.com/chart/interactive/docs/gallery
-
https://plot.ly/javascript/#basic-charts(tested and working in Tiki 18.x by using the png export option. )
Running JavaScript server-side in PHP
- https://github.com/reactjs/react-php-v8js
- http://www.php-js.com/
- https://www.openhub.net/p/PHPJS
- http://php.net/manual/en/v8js.examples.php
- https://www.openhub.net/p/v8js
About MathJAX support
- http://www.mpdf1.com/forum/discussion/1046/how-does-mpdf-support-svg-and-mathjax/p1
- http://mpdf1.com/manual/index.php?tid=495
- https://github.com/mpdf/mpdf/issues/41
About screen capture
Related links about the topic
- http://www.mpdf1.com/forum/discussion/428/graphs-from-google-chart-tool-in-pdf/p1
- http://engineering.brandwatch.com/server-side-rendering-of-visualisations-using-nodejs/
- http://inside-out.xyz/technology/how-to-take-a-snapshot-of-an-html5-container.html
- https://plot.ly/javascript/static-image-export/
- https://github.com/chartjs/Chart.js/issues/99
- Server-side JavaScript
- https://github.com/wikimedia/mathoid
- https://github.com/jgraph/draw-image-export2