Create indd doc with appscript
require 'rubygems'
require 'appscript'
include Appscript
outputDir= File.join(ENV['HOME'],'Desktop')
pdfpath = File.join(outputDir, "myTempFile.pdf")
filepath = File.join(outputDir, "myTempFile.indd")
idApp = app('Adobe InDesign CS3')
#idApp = app('InDesignServer')
myDoc= idApp.make(:new => :document)
myFrame = idApp.documents[1].pages[1].make(:new => :text_frame)
myFrame.geometric_bounds.set(['6p', '6p', '18p', '18p'])
myFrame.contents.set("I\xC3\xB1t\xC3\xABrn\xC3\xA2tiz\xC3\xA6ti\xC3\xB8n")
myDoc.export( {:format => :PDF_type, :to=> MacTypes::FileURL.path(pdfpath).hfs_path})
myDocSaved = myDoc.save(:to=> MacTypes::FileURL.path(filepath).hfs_path)
myDocSaved.close()