November 2019
Beginner
436 pages
8h 52m
English
In this section, we are going to introduce support for PDF generation based on the markdown source. Once we've finished, the users of our application should be able to generate PDF output with Cmd + Alt + P on macOS and Ctrl + Alt + P on other systems.
Let's update the code in order to provide PDF output support:
editor.addCommand( monaco.KeyMod.CtrlCmd | monaco.KeyMod.Alt | monaco.KeyCode.KEY_P, () => { const code = editor.getModel().getValue(); generatePDF(code); } );
The generatePDF function implementation should be reasonably easy for you. It resembles the genereateHTML one, but in our case, we're passing pdf as a format attribute.
Read now
Unlock full access