I have been making courseware these two days. Personally, I don’t like PPT very much. Not if I can. I’m a big fan of minimalism.

Who let us are programmers, so fell in love with Jupyter courseware writing, speaking truth markdown is also a very good format for writing books ah.

Jupyter is a Jupyter notebook, and the notebook is a Jupyter notebook. The notebook is a Jupyter notebook

Good that next is to use Jupyter, after starting Jupyter, use the browser to access the corresponding IP:Port can be used. Yes, Jupyter is one such place to write Python using a website.

But hand out handouts to the students to see, ipynB format of the document is certainly not convenient ah, others have not had a class, which know so much? Furthermore, THE PDF can also be opened anytime and anywhere. So I wanted to convert it to PDF.

However, when you open the file and click Download, Error appears

Then, following this Error, I went to Google and found that the most said is to install a latex environment. The complete installation package for MAC takes nearly 3 GIGABytes! I don’t need such a big package just for a PDF, do I? So think of other ways.

Although Jupyter isn’t exactly PDF friendly, it’s great for HTML, but HTML is HTML (and that’s not nonsense)… But I can convert HTML to PDF.

I later learned that Python has a package called PDfKit for converting PDF files. So now ALL I need is pdfKit support on my MAC? So it’s a process of trying.

  1. PIP install pdfkit

  2. Download the system installation package wkhtmltopdf.org/ here. This one is only 48MB.

  3. Finally, there’s why Python is “multimembrane excellent”! Look directly at the code

It’s also easy to operate:

At this point, the IPynb file has been successfully converted into a PDF file, and the color and format are all retained!

Follow the public account “Python column”, background reply “zSXQ06”, get the full set of source code for this article!