Code as picture and PowerAutomateDesktop

I want to make an e-book from RCSG . For this I need to put the code into the book in a nice form. However , the Word document and the PDF and the HTML all have the ideas of formatting the code. How one can accommodate various formats ? Short answer: picture. What if I take a screenshot of the code , as it is formatted in VS / VS Code ? 

But how ? One idea is to open VS and take screenshot  = but it is too resource intensive.

Other idea is internet- I found 2 sites: https://ray.so/  and https://carbon.now.sh/  . What if I use those sites  ?

The obvious solution is Selenium . The other is iMacros . I was thinking to another solution – Power Automate Desktop . Even in preview, it can record the browser actions ( open, goto url, click buttons) and even execute javascript :

function ExecuteScript() {
document.getElementsByClassName(‘jsx-2004545632 ‘)[0].click();
document.getElementById(‘export-clipboard’).focus();
document.getElementById(‘export-clipboard’).click();

  }

 

So I have made a flow to execute https://carbon.now.sh/   and another to save the image in paint ( and crop )

You can find the end result here : https://ignatandrei.github.io/RSCG_Examples/#rscg-number-1—thisassembly