• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
9

Script to fit group of objects to page proportionally.

Explorer ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

I need to go through a large document that have individual items on each page (text boxes, picture boxes, rectangles of different colors etc.)

At the moment I am doing this manually for each page:

 

1-group all items on the page

2-manually enlarge proportionally, and fit to page
(I use fn+Cmnd+Shift while resizing the group) so all objects including text and pictures would scale accordingly.

 

This is a repetitive task and seems that I will have to do the same on new documents I will recive. So I was wondering if there is a way of doing this with a script.

 

I found this:

https://community.adobe.com/t5/indesign-discussions/is-there-a-javascript-to-resize-a-frame-to-page-...

 

var doc = app.activeDocument;
var myPage = doc.pages[0];
var fit = myPage.bounds;
var myFrame = app.selection[0];
myFrame.geometricBounds = fit;

 

The above is similar to what I am after but it scales the objects, and the contents remain the same. So for instance, it will enlarge the text box but the text stays the same size.

 

Is there a way of scaling to fit the page with contents and and keeping the proportions? Maybe a shortcut or better still a script? Or maybe I could tweak the script above so that it scales pictures and text proportionally?

 

Any guidance or ideas welcome.

Thanks.

 

TOPICS
Scripting , Type

Views

193

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

You'd have to get the horizontal and the vertical scale to fit the group to the page bounds. Then use the smallest value to scale the group, either using myGroup.horizontalScale and myGroup.verticalScale, or myGroup.resize (...). Then move the group to the top left of the page.

 

Scaling like that enlarges objects and text in the grouped frames.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

Thanks Peter, I am just starting with scripting so I wil see if I can tweak the script above and make it work. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

Is it just so you can print it on a differennt size of the paper - or will you have to work on the contents later?

 

▒► ID-Tasker / ID-Tasker Server - work smart not hard ◄▒

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

Hi Robert, thanks.

It is so that I can fit the different grouped elements to various documents.

These docs will have different (non standard) page sizes.

I should be able to ungroup and edit the different items if needed.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

OK, so if proportions are different and you need to be able to edit - then what I was "suggesting" won't work - exporting as PDF and then resizing when importing into a new document.

 

Unfortunately, you are on a Mac so my ID-Tasker won't help you.

 

▒► ID-Tasker / ID-Tasker Server - work smart not hard ◄▒

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

Yes unfortunately PDFs won't work, but thank you for thinking of alternatives Robert.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

Hi @A27300849wzxk 

 

A powerful method is to change the inner scale of the pages themselves so you don't need to change anything else at the object level. Not sure this is what you're looking after but this might be close. See e.g. the TotalRescale script for a basic application of that idea.

 

Best,

Marc

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 25, 2023 Sep 25, 2023

Copy link to clipboard

Copied

LATEST

Hi Marc, thanks for the suggestion, but it seems that it would be difficult to edit after using TotalRescale.

"TotalRescale relies on transformations that you CANNOT DIRECTLY OPERATE OR REVERSE FROM THE USER INTERFACE."...

Regards

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines