Print IDE Desktop Code to PDF

I was fooling around, waiting for a download to end and I went to add a simple new feature to an old Desktop project.

Then, I wanted to place the code in TextEdit with a screen shot, so I printed the PushButton code to a PDF file.

I opened the generated file with Preview,
Copy all,
Paste into my TextEdit Document,

and was happy to have a syntaxy colored text.

All of a sudden, while I wanted to add the screenshot (to get a complete explanation about the code change), I realized some “page layout” errors…

Empty lines, missing EOL, etc.

For only 4 lines of code (around 20 lines with comments), this ruin absolutely the whole purpose…

Worst, I had many years ago to restore a project from a two days old pdf print (a print of the whole project); with the current state, it is nearly useless…

Environment:
Computer: MacBook Pro m1
OS: macOS 11.5.2 (Big Sur)
Preview: Version 11.0 (1018.6.2)
TextEdit: Version 1.16 (365.2)

Conditions:
Add a PushButton to a Project,
Add an Action Event
Add // followed by a bunch of ‘ ----------
Add Comments to explain what the code do
Add the code
File → Print → Save to PDF

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.