Add repeat watermark using pyuno

How to add watermark as the picture described using pyuno?

Does the info here work?

I have found the code and it works.
and question comes that how to draw a rectangle and add text then save it into png file
also the ui’s transparency property , how to set in the code