Use case or problem
While it is possible to export a note in PDF, the export does not take in account the UI theme currently in use (i.e. the Preview’s CSS).
However, such a feature would be easy to implement and extremely useful for producing good-looking and professional documents within minutes.
The following article suggest a way of generating a PDF using two JS libs:
In sum, the process is the following:
- Convert the preview’s root HTML node into a canvas.
At a quick glance, this would be
- Convert the obtained HTML into a PDF.
This method produces a rasterized (image) PDF.
While this doesn’t allow for text selection, it is sufficient for most uses.
My suggestion is to implement this feature alongside the existing PDF export, thereby providing two export functions, something like:
“Export Markdown to PDF” // Existing export function
“Export Preview to PDF” // Through JSpdf
Related feature requests (optional)
This is somewhat related:
Also related, any feature request pertaining to HTML export.