Created
October 8, 2012 15:31
-
-
Save ff6347/3853132 to your computer and use it in GitHub Desktop.
fit page to textFrame
This file contains 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
var doc = app.documents.add(); | |
var page = doc.pages.item(0); | |
var tf = page.textFrames.add({ | |
geometricBounds:[12.7,12.7,100,210], | |
contents: "Hi God, it's me - Jesus." | |
}); | |
tf.paragraphs.item(0).pointSize = 42; | |
tf.fit(FitOptions.FRAME_TO_CONTENT); | |
doc.documentPreferences.pageWidth = tf.geometricBounds[3] + 12.7; | |
doc.documentPreferences.pageHeight = tf.geometricBounds[2] + 12.7; | |
var new_pw = doc.documentPreferences.pageWidth; | |
var new_ph = doc.documentPreferences.pageHeight; | |
tf.geometricBounds = [12.7,12.7,new_ph - 12.7,new_pw - 12.7]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment