Copy link to clipboard
Copied
This is an ID file with hundred of tables, one per page, unthreaded.
We need to rescale at 90%.
We need to place them in the layout as ID format to adjust them.
The idea of using a Pdf is not convenient...
Thanks.
var myDoc = app.activeDocument
var scaling = app.transformationMatrices.add()
scaling = scaling.scaleMatrix(0.9,0.9)
for ( var i = 0; i < myDoc.pages.length; i++ ){
for ( var j = 0; j < myDoc.pages[i].textFrames.length; j++ ){
//myDoc.pages[i].textFrames[j].tables.everyItem().width = desiredTableWidth;
myDoc.pages[i].textFrames[j].transform(
CoordinateSpaces.INNER_COORDINATES,
AnchorPoint.TOP_LEFT_ANCHOR,
scaling
)
}
}
If all
...Copy link to clipboard
Copied
Hello @palala fog ,
From what I can see there isn't a way to set Table widths or cell width through a style. The only way that I could see to automate this would be to create a script that resizes all the tables.
Below is something I bashed out quickly. I only tested very quickly and it seems like it does the job.
var desiredTableWidth = 140;
var myDoc = app.activeDocument
for ( var i = 0; i < myDoc.pages.length; i++ ){
for ( var j = 0; j < myDoc.pages[i].textFrames.length; j++ ){
myDoc.pages[i].textFrames[j].tables.everyItem().width = desiredTableWidth;
}
}
Copy link to clipboard
Copied
hi,
first, thanks. your script is very interesting because it really scales the tables to a defined measure!
in this case, you propose 140 mm that maintains accurate font sizes and weight lines, for example.
here we need to reduce 90% the whole table because the book changed size and we need a smaller size.
it is possible to script this?
Copy link to clipboard
Copied
Hello@palala fog ,
Do you need the fonts and the strokes scaled as well? are all tables the same size?
Technicaly we could have the script do everything but this is a lot more work to code something up. You could have a table style (with paragraph) handle the rescaling of fonts, strokes and padding.
Regards
Copy link to clipboard
Copied
Hi, if I just select the table and reduce it 90% by menu, immediately the table gets a fine size (Body text changes from 9 to 8 pt, for example, better adapted to the smaller size of the document) and no matter at all the size.* I mean: the idea is to reduce the whole table as a unity. There are many sizes.
As we have 300 tables this manual procedure to resize them seems illogical.
Thanks
*Although your script is a very good piece to adapt tables to a defined length.
Copy link to clipboard
Copied
var myDoc = app.activeDocument
var scaling = app.transformationMatrices.add()
scaling = scaling.scaleMatrix(0.9,0.9)
for ( var i = 0; i < myDoc.pages.length; i++ ){
for ( var j = 0; j < myDoc.pages[i].textFrames.length; j++ ){
//myDoc.pages[i].textFrames[j].tables.everyItem().width = desiredTableWidth;
myDoc.pages[i].textFrames[j].transform(
CoordinateSpaces.INNER_COORDINATES,
AnchorPoint.TOP_LEFT_ANCHOR,
scaling
)
}
}
If all you have is just tables then this scales every text frame to 90%.
Copy link to clipboard
Copied
Dear Tacoeater,
For the moment your script worked perfectly.
It worked really fantastic.
Thanks for your time and patience.