I'm working on a tool which converts a simple PSD file into HTML.
I'd like to use 2 layers to convert the text:
- A text layer to generate the text for HTML and font info for CSS;
- An optional shape layer to generate the border info for CSS.
Photoshop CS6 and later versions provide a Copy CSS feature, which is suitable for grabbing CSS border info from Live Shape layers. I've used ScriptListener and got the code to run this menu command. Now I'm wondering how do I get the CSS code from the system pasteboard?
I come up with 2 possible ways which I haven't tested yet.
1. Create a new text layer and call some commands to paste. Then I get the text info using the TextItem.contents property;
2. Use Adobe Generator to send a signal to the Node.js server. Then use child_process.exec provided by Node.js to run the Unix pbpaste command and pipe the output.
Does one of the methods work? Or is there a much easier way?
Thanks.