Pasteboard Expander for InDesign CS5-CS6
October 24, 2012 | Snippets | en | fr
Sometimes we are left with temporary objects that flow over the pasteboard. Part of these objects that still intersects the white area remains visible, but InDesign refuses to show us what happens beyond.
Of course you can select the frames and contemplate their bounding boxes:
but it remains impossible to guess what they contain.
An obvious solution is to globally increase the visible margins of the pasteboard via Preferences > Guides & Pasteboard > Pasteboard Options. Not really inventive!
InDesign CS5 (and later) offers a much more fun trick. As soon as we set some guides beyond the current bounds—which is only possible with the power of scripting—InDesign accordingly expands the viewport:
This gave me the idea of writing a simple “PasteboardExpander”, which automatically fits the active spread with respect to any ‘extra’ content. Here is the snippet that makes the magic happen:
// InDesign CS5/CS5.5/CS6 // ===================================== (function(s,a,m,f,i,x) { (s=s[a][f+'Window'])&& (s=s[a][f+'Spread'])&& ( // Prevent 'locked guides' issues! // --- app.documents[x]().preferences[x](). properties={guidesLocked:false}, // Retrieve the page bounds // --- a=s.pages[x]().bounds, // Min-max algo on page bounds // --- m=[m,m,-m,-m], (f=function(v,t) { while(t=a.pop(i=4)) while(i--) (t[i]<m[i])^(i>>1)&&(m[i]=t[i],m[~i]=v) })(), // Min-max algo on page items bounds // --- a=s.pageItems[x]().visibleBounds,f(1) ) // OK, create the guides where needed // --- while(i--)m[~i]&& s.guides.add({location:m[i], orientation:1&i?1986359924:1752134266}) })(app,'properties',1/0,'active',0,'everyItem');
Have fun!
Comments
Thanks a lot, useful script!
Cool !
Il m'arrive parfois d'avoir des soucis de ce genre suite à une rotation, ou lors d'importation…
Voilà de quoi y remédier.
Merci Marc :)
Très sympa comme découverte et encore plus sympas d'en avoir fait un script !
Merci.
Magnifique, ça évite de passer par les préférences.
Merci! Ce script est très utile pour moi.
----
Thanks, this script is very useful.
Nice script, Marc! I didn't know that you could extend the pasteboard of a spread like this. I can use this to create some temporary sketching space to draw a graph or whatever, or to set a landscape table (rotating a spread is a hassle).
Thanks,
Peter