-
1. Re: [JS][CS4] - Transformation Matrix and Tables
[Jongware] Nov 23, 2011 2:03 PM (in response to booyajamo)Is that a table inline in running text, or in a frame of its own, or an anchored object perhaps?
-
2. Re: [JS][CS4] - Transformation Matrix and Tables
booyajamo Nov 23, 2011 2:21 PM (in response to [Jongware])It's in a frame of it's own. Does the transformation Matrix treat each of those scenarios you mention above differently?
-
3. Re: [JS][CS4] - Transformation Matrix and Tables
[Jongware] Nov 23, 2011 2:35 PM (in response to booyajamo)lindsaygensinger wrote:
It's in a frame of it's own.
Well then you got yourself a weird side-effect Your script only applies the scaling to 'pageItem[0]', any old item that would be the very first on that page. It leaves all others unchanged (or so it should, but then that could be the weird side effect).
By the way, your script didn't run straight away, there were a couple of typo's. Please make sure to copy the exact script that works for you (or in this case, that doesn't work).
By the way #2: do you deliberately scale down all of your pages except the last one?
Anyway, a solution that worked for me is to grab all of the page items into a single group and then apply your code:
doc = app.activeDocument; for (i=0; i<doc.pages.length-1; i++){ var myGroup = doc.pages[i].pageItems.everyItem(); var myScaleMatrix = app.transformationMatrices.add({horizontalScaleFactor: .8, verticalScaleFactor: .8}); myGroup.transform(CoordinateSpaces.pasteboardCoordinates, AnchorPoint.CENTER_ANCHOR, myScaleMatrix); }(With typos fixed so I know it works. Mind you, it still doesn't scale down the very last page.)
-
4. Re: [JS][CS4] - Transformation Matrix and Tables
[Jongware] Nov 23, 2011 2:39 PM (in response to [Jongware])I now notice there is a slight re-run in the text of my test file. Some things will not stay the same when scaling down, apparently.
Perhaps a better way would be to export to PDF and scale that down into a new document.
-
5. Re: [JS][CS4] - Transformation Matrix and Tables
booyajamo Nov 23, 2011 2:45 PM (in response to [Jongware])I appreicate the help! I've tried grouping all items like you say and yes, I get that slight re-run of text. I aplogize for the typos. I'm working on a few different systems and can't copy/paste. After trying to scale down or up I thought maybe it was just a problem with the loop or maybe an inherent problem when trying to scale tables with a transform matrix. Why would it work correctly if I don't loop and I directly tell it to scale the first pageItem on the first page? Is the loop, going through the page a second time or something and reducing the table a second time?
I don't fully understand how the adjustLayout works but might that be a solution to look into? If I adjust the margins down or up will I be able to scale the contents to the margins?
Thanks!
Lindsay
-
6. Re: [JS][CS4] - Transformation Matrix and Tables
[Jongware] Nov 23, 2011 2:56 PM (in response to booyajamo)lindsaygensinger wrote:
Why would it work correctly if I don't loop and I directly tell it to scale the first pageItem on the first page? Is the loop, going through the page a second time or something and reducing the table a second time?
Theoretically, no. I got a different result, but it may just be a side effect of the actual way your document is designed.
lindsaygensinger wrote:
I don't fully understand how the adjustLayout works but might that be a solution to look into? If I adjust the margins down or up will I be able to scale the contents to the margins?
No, Adjust Layout doesn't work that way. First of all, it only works correctly for page items that fill the entire margins of your document. Objects that touch a page margin get moved but not scaled down.
Second, and more important, it doesn't scale your text down inside the frames. It's designed to allow for margin changes, and as such it will radically move your text around.
If you have a complete finished document and just need to scale to another page size, go with the PDF route. Alternatively -- I don't have experience with this -- you can place your entire original InDesign document into a new correctly sized one.
I think you can use Scott Zanelli's MultiPageImporter to do either.
(Gosh whats up with Jive today!? I can't even reliably insert a hyperlink, I have to double-check in the raw HTML view if it actually worx!)
-
7. Re: [JS][CS4] - Transformation Matrix and Tables
booyajamo Dec 13, 2011 9:13 AM (in response to [Jongware])After much toil I seemed to have solved my problem. The code below works although I don't understand why it works and my previous code didn't.
var i, myObj=[]; for (i=doc.pages.lenth-1; i>=0; i--){ myObj = doc.pages[i].pageItems; if(myObj.length > 1){ doc.pages[i].groups.add(myObj); var myObj = doc.pages[i].groups[0]; myObj.horizontalScale = myObj.horizontalScale +5.03; myObj.verticalScale = myObj.verticalScale+5.03; } }Any insight is appreciated!


