Skip to content

Instantly share code, notes, and snippets.

@grefel
Last active August 29, 2015 14:03
Show Gist options
  • Save grefel/2e03c6c286e87ef0d667 to your computer and use it in GitHub Desktop.
Save grefel/2e03c6c286e87ef0d667 to your computer and use it in GitHub Desktop.
Get type area from page #indesign #js
function getTypeArea(page) {
typeArea = {};
typeArea.y1 = page.marginPreferences.top;
typeArea.x1 = page.side == PageSideOptions.LEFT_HAND ? page.marginPreferences.right : page.marginPreferences.left;
typeArea.y2 = page.bounds[2] - page.marginPreferences.bottom;
typeArea.x2 = page.side == PageSideOptions.LEFT_HAND ? page.bounds[3] - page.marginPreferences.left : page.bounds[3] - page.marginPreferences.right;
typeArea.geometricBounds = [typeArea.y1, typeArea.x1, typeArea.y2, typeArea.x2]
typeArea.height = typeArea.y2 - typeArea.y1;
typeArea.width = typeArea.x2 - typeArea.x1;
return typeArea;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment