I find MS Word's (and other programs') option to fit view to page width very useful.
On my monitor, 200% is about the right size, but the initial view isn't centred, which adds a further fiddle to getting this working view as I want it.
I haven't find a way to automate setting the view to page width and centred horizontally.
What have I missed?
CS4 Zoom to Page Width ?
InDesign doesn't have a ''fit width'' command, and you must have pretty uniform document widths if 200% is consistently about the right zoom level. There is a default shortcut for that, Ctrl + 2 on the top row of the keypad, but it will zoom either to the same center as the current view, or to the center of whatever is selected, if you have a current selection.
I suspect you could script zooming to any pre-determined magnification and center horizontally, then assign a shortcut to the script or run it from the scripts panel. It's probably even possible to calculate the correct zoom percentage based on page width so it would work with any document. You might want to ask over in the scripting forum.
Peter
CS4 Zoom to Page Width ?
Thanks, Peter.
I'm making a book at A4 size which fits neatly at 200% on my monitor, but the initial horizontal offset is the boring bit.
I'll look at scripting it.
Peter_Spier@adobeforums.com wrote:
%26gt; It's probably even possible to calculate the correct zoom percentage based on page width so it would work with any document. You might want to ask over in the scripting forum.
%26gt;
Hmm. Writing a script that'll zoom to the correct width requires that
the script know the resolution of the monitor, and the width of the
window besides the page size. Not an easy task...
Here's one which will center the current text frame in the window and
zoom to 200 percent. I've created one at 200% and another at 300% and
replaced the command-2 and command-3 shortcuts with these scripts (in
text context).
try{
var sel=app.selection[0];
if(sel.hasOwnProperty(''parentTextFrames'')){
app.select(sel.parentTextFrames[0]);
}
app.activeWindow.zoomPercentage = 200;
app.select(sel);
}
catch(e){}
--
Harbs
http://www.in-tools.com
Peter Spier did NOT say it would be easy, only possible. Miracles are your department. ;)
Peter_Spier@adobeforums.com wrote:
%26gt; Peter Spier did NOT say it would be easy, only possible. Miracles are your department. ;)
%26gt;
Miracles?
Be careful what you wish for... ;)
It was easier than I first thought.
ZoomToPageWidth();
function ZoomToPageWidth(){
try{
var window = app.activeWindow;
if(! (window instanceof LayoutWindow) ){return}
var windowWidth = window.bounds[3]-window.bounds[1];
var doc = app.documents[0];
var horizViewPrefs = doc.viewPreferences.horizontalMeasurementUnits;
doc.viewPreferences.horizontalMeasurementUnits =
MeasurementUnits.points;
var pageWidth = doc.documentPreferences.pageWidth;
window.zoom(ZoomOptions.fitPage);
window.zoomPercentage = (windowWidth/pageWidth)*100;
doc.viewPreferences.horizontalMeasurementUnits = horizViewPrefs;
}
catch(e){}
}
--
Harbs
http://www.in-tools.com
Peter,
Look what happens when you get me going... :(
Here's one which will fit the width of any selected object or text frame
to the width of the window. If nothing is selected, the page width will
be fit.
ZoomToWidth();
function ZoomToWidth(){
try{
var sel=app.selection[0];
var window = app.activeWindow;
if(! (window instanceof LayoutWindow) ){return}
var windowWidth = window.bounds[3]-window.bounds[1]-35;
var doc = app.documents[0];
var horizViewPrefs = doc.viewPreferences.horizontalMeasurementUnits;
doc.viewPreferences.horizontalMeasurementUnits =
MeasurementUnits.points;
var theWidth = doc.documentPreferences.pageWidth;
if(sel %26amp;%26amp; (sel.hasOwnProperty(''parentTextFrames'') ||
sel.hasOwnProperty(''visibleBounds'')) ){
if(sel.hasOwnProperty(''parentTextFrames'')){
var textFrame = sel.parentTextFrames[0];
var frameBounds = textFrame.visibleBounds;
app.select(sel.parentTextFrames[0]);
}
else{frameBounds = sel.visibleBounds}
theWidth = frameBounds[3]-frameBounds[1];
}
else{window.zoom(ZoomOptions.fitPage);}
window.zoomPercentage = (windowWidth/theWidth)*100;
doc.viewPreferences.horizontalMeasurementUnits = horizViewPrefs;
app.select(sel);
}
catch(e){}
}
--
Harbs
http://www.in-tools.com
That script is quite brilliant and works a treat.
Very many thanks.
I used to speak C. Must have a look at scripting!
Sorry Harbs. (not really) :)
I'll have to give these a go.
Isn't this a wonderful place to hang out?
Peter
Well it was kind of fun to write (and I'll probably use this a lot
too...). But, I did need to go to sleep! :)
--
Harbs
http://www.in-tools.com
I assigned it to the unassigned CTRL-\, which sort of matches the ''fit sequence to timeline width'' in Premiere Pro.
If you are considering making this script universally applicable, then as I'm sure you know already, it scales for full screen width which doesn't give the desired result in an unmaximised window.
But I don't need this enhancement since I work full screen on one of two monitors and the script does just what I want already.
Really, really useful. Many thanks again.
Hi David,
I wrote this on a Mac, so I don't know exactly how many pixels are used
for window element on Windows.
In the second script I subtracted 35 pixels for the scroll bar on the
right and ruler on the left. That seems to be a good number for both
maximized and non-maximized windows on the Mac.(It leaves a couple of
pixels of space around the object which looks much better than being fit
exactly.) Although it does not work properly when the Application Frame
is being used (yet).
If you (or someone else) would do some experimentation as to how much to
subtract for Windows, I could make it universal. I imagine there might
be a difference between XP and Vista as well...
--
Harbs
http://www.in-tools.com
Harbs,
Thanks again for pursuing this.
I am running ID CS4 under Win XP SP3 on a 1280x1024 19'' screen set to display at 96.012dpi for accurate 1:1 scaling.
Tested with an A4 document (210mm wide) and default 12.7mm page margins left and right. Page text frame from 12.7mm to 19.73mm.
I measured the pixel widths using HyperSnap frame grabber.
With ID maximised, the document window width is 1171 pixels inside the rule and scrollbar boundaries with the palettes minimised on the right. The script correctly displays the full width of the document window with approximately 3mm side margins in view (ie approx 9mm to 200mm on the top ruler).
With ID ID maximised, but the palettes expanded, document window width is reduced to 801 pixels, but the script doesn't change scale so a lot of width is hidden now - 40mm to 170mm visible.
With the palettes minimised from here on and the ID window unmaximised and sized variously (measurements accurate to approx .5mm only)....
With a document window width of 1004pix, the script shows the full text width from 10mm to 200mm.
With a document window width of 757pix, the script shows from 13.5mm to 156.5mm and loses some text off the sides.
With a document window width of 501px, the script shows from 19mm to 191mm and loses more text off the sides.
Hope this is useful. Please ask if more would help.
The question is what InDesign thinks the window width is relative to the
usable area. This one liner script will give you the width of the
current window in pixels. Comparing this number to the one you got by
measuring it will give us an idea of the usable area relative to the
actual size.
alert(app.activeWindow.bounds[3]-app.activeWindow.bounds[1]);
--
Harbs
http://www.in-tools.com
Thanks for the extra script, which reports as follows:
Full screen with minimised panels = 1288.
Full screen with extended panels still = 1288.
At my previous minimum width = 658.
The minimum width where your script shows all the text on my line = 906.
The edges of the text area with my margins are visible down to about 940.
I'm not sure exactly what the magic number is on Windows. There's also
no straight-forward way of knowing how much room the panels take up when
the application frame is being used. Below is a link for a version which
seems to work reasonably well on the Mac, both with and without the
Application Frame. When the height of a page is too high, there might be
some extra space on each side (i.e. it will not zoom to the maximum),
but the text should never be cut off. The ''magic number'' on Windows
probably needs some adjustment. I also don't know I don't have a copy
installed right now to test.
Let me know how it is...
http://in-tools.com/indesign/scripts/freeware/ZoomToWidth.jsx
--
Harbs
http://www.in-tools.com
Something awry somewhere.
The new script attempts to fit height, not width, on my system.
When maximised, the top line of text is cut off.
When less than maximised it seems to work quite well.
David_J@adobeforums.com wrote:
%26gt; Something awry somewhere.
%26gt;
%26gt; The new script attempts to fit height, not width, on my system.
%26gt;
%26gt; When maximised, the top line of text is cut off.
%26gt;
%26gt; When less than maximised it seems to work quite well.
%26gt;
Huh?
It works to the width when not maximized?
You shouldn't be seeing ''fit to height''. If the pages are too tall, you
might be seeing that it's not zooming all the way to the width, but not
to the height. I changed the Windows behavior to that of the Mac. The
behavior depends on whether the application frame is in use.
Download again, and try with and without the application frame...
--
Harbs
http://www.in-tools.com
Fresh copy of script from your link above works just like the one I described already. No fit to width, only fit to height.
No choice of Application Frame on a PC - it's always windowed.
As an extreme example, I made an unmaximised application window wide and not very tall. The result from the script was a small-scale document fully displayed in height and occupying only a small central part of the available window width.
I have only tried at my default screen resolution of 1280x1024. I'll try others if you wish when this height v width issue has been resolved.
hmm. strange. I'll have to play with it on a Windows machine...
--
Harbs
http://www.in-tools.com
I just downloaded it and it seems to be working pretty much as I would expect on my system. I'm running XP SP2.
I just put in a new 27'' widescreen and I've always worked maximized with panels open on the right (and the MS Office Bar, too -- don't ask). The script is zooming to the page width or to the object width if something is selected or a text cursor is active. It always zooms to vertically center the object, though, and it would be kind of cute, if it isn't a lot of trouble, if it centered vertically on an active text cursor.
Peter
Subscribe to:
Post Comments
(Atom)
No comments:
Post a Comment