splitbrain / dokuwiki-plugin-dw2pdf

A fork of Luigi Micco's PDF export plugin for DokuWiki

Home Page:http://www.dokuwiki.org/plugin:dw2pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

support of Mermaid (flowcharts plugin)

gilcot opened this issue · comments

Hello,

We are using Mermaid syntax and I'm looking for the way to make it work with this plugin: diagrams aren't rendered in the PDF, but the condensed source. Any hint is appreciated.

Regards.

mermaid generates diagrams client side using Javascript. PDFs are generated server-side. it's not possible.

Thanks for the reply. What's the underlying library used to generate the PDF documents ? I should look if there's something possible, but that area is a bit confuse for me when reading https://stackoverflow.com/questions/9219807/documentation-for-using-javascript-code-inside-a-pdf-file

Lot of pdf readers do not support JavaScript. Therefore, it only useful (in my understanding) for specific stuff like forms, where it is fine to require the readers to use feature-full pdf-readers.

For a more general pdf where just your diagrams needs to be displayed this JavaScript in pdf is not a robust approach.

I had a quick look in the documentation of mermaid js. This mermaid has some options to generate static content (as svg). That uses a webpack or a API. Please read further your self for better idea of the concept.
https://mermaid-js.github.io/mermaid/#/usage?id=usage-with-webpack
I have no idea how one could get a trigger from php from the pdf exporter used by the Dw2pdf to this JavaScript stuff that generates the static svgs. If that functionality is built, I expect it becomes part of the Flowcharts Plugin. Maybe you need extra modules/special configuration on your server. Further, if you start developing this, or another developer for you, it is recommended to test in an early stages whether the SVG generated by the mermaid js is processed well enough by the pdf generation library mPDF, which is the internal pdf generator used by the Dw2pdf Plugin. This library is known for some limitations, so testing is recommended.

Summary: Dw2pdf support should be built in flowchart plugin (https://www.dokuwiki.org/plugin:dw2pdf:exportsupport )
Probably that plugin needs more steps to come to the desired result. Please be aware of the possible limitations of these steps.