Loading...
 
Skip to main content

History: Converting dynamic JavaScript content into static assets

Source of version: 13 (current)

Copy to clipboard
^ One working solution is to use ((doc:Browser Automation)) to generate static content from dynamic content. This has multiple uses such as for:
* ((mPDF))
* ((Newsletters))
This [https://sourceforge.net/p/tikiwiki/code/75397|works in Tiki21] for ((doc: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. {sign user="marclaporte" datetime="2017-12-12T02:19:23+00:00"})

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
* http://phantomjs.org/screen-capture.html
** https://github.com/jakoch/phantomjs-installer
** http://jonnnnyw.github.io/php-phantomjs/


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

-=alias=-
* (alias(Images generated in JavaScript))
Show PHP error messages