#!/usr/bin/env ruby # for Adobe InDesign # changes the page size of the document, and scales every item on every page # edit the following: PAGE_WIDTH = 1024 PAGE_HEIGHT = 768 # I'm using points, coz they're the same as pixels (72ppi) SCALE_AMT = 2.0 # This is the scale factor, so 2.0 == 200% require 'rubygems' require 'appscript' include Appscript def set_units(to) @doc.view_preference.horizontal_measurement_units.set(to) @doc.view_preference.vertical_measurement_units.set(to) end @indesign = app('Adobe InDesign CS4.app') @doc = @indesign.active_document @original_measurement_units = @doc.view_preference.horizontal_measurement_units.get[0] set_units(:points) @doc.document_preferences.page_width.set(PAGE_WIDTH) @doc.document_preferences.page_height.set(PAGE_HEIGHT) # make a matrix to apply during the loop matrix = @indesign.make(:new => :transformation_matrix) matrix = @indesign.scale_matrix(matrix, :horizontally_by => SCALE_AMT, :vertically_by => SCALE_AMT) # loop through all the pages for i in 1..@doc.pages.get.length @indesign.transform( @doc.pages[i].page_items(:every), :in => :pasteboard_coordinates, :from => [[PAGE_WIDTH/2, PAGE_HEIGHT/2], :center_anchor], :with_matrix => matrix ) end # tidy up set_units(@original_measurement_units)