Epub export from Pages

I thought it easy to write something for Pages. BUT, it isn’t. I tried to figure out how to:

  1. add text to Pages (ok)
  2. to add a title page filled with a picture (cover)
  3. maybe to add metadata like author and title, rights for the file to export
  4. to export this beautiful file in epub format.

til now i’m able to fill pages with content, nothing more. The export feature doesn’t work at all.

set text_cont to "Blabla"

tell application "Pages"
	set d to make new document -->OK, but not set d to make new document with properties (name: "Name", body text: text_cont)
	set body text of d to text_cont-->OK
	save d as "SLDocumentTypeEpub" in (path to desktop as text) & title_nm & ".epub" -->the exported file is empty!
   --save document 1 as "SLDocumentTypeEpub" in (path to desktop as text) & title_nm & ".epub" -->no way
end tell

If you’ve upgraded to Lion, you might try the new “Text to EPUB” action in Automator. I haven’t tried it myself, but I watched a demo of it from WWDC and it seems to be a very easy way of making EPUBs.