I have tricky questions, I receive email with some HTML code in it which generates some CSS objects. Objects might have different sizes. I want to transform these objects to png image.
I cannot use canvas2html, because it doesn't support all CSS. Currently I am opening email, making a printscreen and saving it manually but this is not the way to go. I wonder if you have any idea how to automate it.
Currently I busy with scripting it in the way:
- Receive email
- Save css object as html file
- Open file in browser
- Make print screen of entire screen using powershell
- Save it to file
- Using Photoshop actions crop the file
I believe that should work (although I still have some gaps in it like how to automate saving CSS to html file), but I am pretty sure that there must be better way to do that.
Sample code:
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
</head>
<body>
<i id="icon" class="fa fa-linkedin-square" style="text-shadow: rgb(48, 117, 165) 0px 0px 0px, rgb(48, 118, 167) 1px 1px 0px, rgb(49, 120, 169) 2px 2px 0px, rgb(49, 121, 171) 3px 3px 0px, rgb(50, 123, 173) 4px 4px 0px, rgb(51, 124, 175) 5px 5px 0px, rgb(51, 125, 177) 6px 6px 0px, rgb(52, 127, 179) 7px 7px 0px, rgb(52, 128, 181) 8px 8px 0px, rgb(53, 130, 183) 9px 9px 0px, rgb(53, 131, 185) 10px 10px 0px, rgb(54, 133, 187) 11px 11px 0px, rgb(55, 134, 189) 12px 12px 0px, rgb(55, 136, 191) 13px 13px 0px, rgb(56, 137, 193) 14px 14px 0px, rgb(56, 138, 195) 15px 15px 0px, rgb(57, 140, 197) 16px 16px 0px, rgb(58, 141, 199) 17px 17px 0px, rgb(58, 143, 201) 18px 18px 0px, rgb(59, 144, 203) 19px 19px 0px, rgb(59, 146, 205) 20px 20px 0px, rgb(60, 147, 207) 21px 21px 0px, rgb(60, 148, 209) 22px 22px 0px, rgb(61, 150, 211) 23px 23px 0px, rgb(62, 151, 213) 24px 24px 0px, rgb(62, 153, 215) 25px 25px 0px, rgb(63, 154, 217) 26px 26px 0px, rgb(63, 156, 219) 27px 27px 0px, rgb(64, 157, 221) 28px 28px 0px, rgb(65, 158, 223) 29px 29px 0px, rgb(65, 160, 225) 30px 30px 0px, rgb(66, 161, 227) 31px 31px 0px, rgb(66, 163, 229) 32px 32px 0px, rgb(67, 164, 231) 33px 33px 0px, rgb(67, 166, 233) 34px 34px 0px; font-size: 151px; color: rgb(255, 255, 255); height: 236px; width: 236px; line-height: 236px; border-radius: 41%; text-align: center; background-color: rgb(68, 167, 235);"></i>
</body></html>