A code-free solution to convert the code file into pdf (for windows)
Visual Studio Code + Print (i.e., an extension of VS Code)
- Install VS Code: download link
- Install extension: Print: link
- Convert your code into pdf
3.1 Open the code file you want to convert use VS Code, then press the "print" button in the top right.
3.2 Choose to print as pdf, that's all.
The following is a result example:


