domToImage JS library not working well on iPhone and Mac

I have a problem with the JS library 'dom-to-image', This JavaScript library converts a div to an image, but it's not working well on iPhone and Mac devices. Sometimes it doesn't work at all, and other times I need to download the image multiple times for it to work. I understand that Mac/iPhone devices have different rendering logic, but is there a way to check what the problem is and how to fix it? I tried dom-to-image-more and some delay but still not working.

Thank you!