Created
July 11, 2013 12:35
-
-
Save mipmip/5975070 to your computer and use it in GitHub Desktop.
Create indd doc with appscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment