Home > Mobile >  Is there an option to save Python files to images with Pycharm?
Is there an option to save Python files to images with Pycharm?

Time:04-26

I have a project I finished, and one requirement is adding all of the code to a Word Document, doing it manually will take hours since I have multiple Python files, each with at least 200 lines.

Is there a way to export them (with the syntax highlighting) to images so I can do it quickly, and be able to add them to the Word Document?

CodePudding user response:

Not in pycharm but in Virsual Studio Code, there is and extension called CodeSnap, maybe just open your project from vscode then take clean screenshots of your code from there.

CodePudding user response:

As I said in the comments, if you take one screenshot of 30 lines in each 3 seconds, in 20 min you can take 400 screenshots containing 12000 lines of code, which might be enough for many projects .

But if you really want to automate it, one idea can be to write a python file that read the files in your project recursively and at each fixed number of lines write the content to a .txt file with a name like file_n.txt, where n is increasing. Then, you convert all the .txt to images programatically using pillow.

  • Related