Forum Documentation

I would like to generate a chart on a PDF

ralphbrabante
Hi Gang,

I would like to use apex chart (https://apexcharts.com/) libraries on my PDFs.

even I enabled javascript on prince it return some error message.

Do I just load the script of the apex chart inside the PDF or I need to start with a function or something?

I saw this GitHub code but I do not know where to start.

https://github.com/yeslogic/prince-scripts/tree/master/compatibility/Highcharts

Thanks in advance. :)
mikeday
We may need to do some further investigation of this library and see if it is depending on JavaScript DOM features we haven't supported in Prince yet.
hallvord
Hi, I've dug around a bit and the first impression is that it will take a bit of implementation work to make this script run. It uses some ES6 features such as const. It depends on APIs like Promise, Element.prototype.classList, and Element.prototype.getBoundingClientRect - I tried a polyfill for the Promise and classList issues but the classList compat shim did itself depend on DOMTokenList which is not supported either.

I might keep digging here, to see if it's possible to get it working, but issues like const is about syntax and thus have no clean compat scripts. The alternative is probably to use a preprocessor like Babel, which might add its own issues.

Announcement: repos for tests/utils