🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9539

Re: Cropping to text frame (indesign cs2)?

#9539
From: Dave_Saunders
Date: Thu, 17 Aug 2006 13:03
31 lines
1476 bytes
Here's what I use:

//DESCRIPTION: Makes page size same as only page item

//Works only on single-page documents with a single (top-level) page item

myDoc = app.documents[0];

if (myDoc.pages.length != 1) {
	Alert("This script works only on single-paged documents");
	exit();
}

if (myDoc.pageItems.length != 1) {
	Alert("More than one page item on page. No can do.");
	// Could offer to group them before proceeding
	exit();
}

myBounds = myDoc.pageItems[0].visibleBounds;
myDoc.pages[0].marginPreferences.bottom = 0;
myDoc.pages[0].marginPreferences.top = 0;
myDoc.pages[0].marginPreferences.left = 0;
myDoc.pages[0].marginPreferences.right = 0;

myDoc.documentPreferences.pageHeight = myBounds[2] - myBounds[0];
myDoc.documentPreferences.pageWidth = myBounds[3] - myBounds[1];

myDoc.pageItems[0].move([0,0],undefined);

Dave
Technical Details
Message-ID: <3bc14b3c.2@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing
References: <3bc14b3c.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,25901b2df2a5f438
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Dave_Saunders@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: Re: Cropping to text frame (indesign cs2)?
Message-ID: <3bc14b3c.2@webcrossing.la2eafNXanI>
Date: Thu, 17 Aug 2006 06:03:22 -0700
References: <3bc14b3c.-1@webcrossing.la2eafNXanI>
Lines: 32
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing