There were similar post a few years ago, maybe this will help:
https://forum.mendix.com/link/questions/87506 which redirects to:
and https://forum.mendix.com/link/questions/8539 which uses a java action
And you should check this stackoverflow question:
In short, it is doable but you will never get it pixel perfect unless you are willing to pay for API's that do it for you.