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

Indesign script to resize all image frames in a document

New Here ,
Oct 31, 2023 Oct 31, 2023

Hello all,

 

I have a document of around 800 pages that is been made by importing PDF pages.

Unfortunately, the document has been set up in the wrong format (A4 instead of Letter size), so I have changed the document dimensions using Adjust Layout and the used this script to fit the content of the image into the newly adjusted frame:

 

app.activeDocument.rectangles.everyItem().fit(FitOptions.CONTENT_TO_FRAME);

 

The problem I am experiecing is that each PDF has a border aroud it which I would like to cut, so I would now like to resize the frame of a couple mm to cut the border. Is there a script I can use to achieve that?
Happy to run one script to do all of it (resizing and cutting) or to run two separate ones.

Thank you!

TOPICS
Scripting
1.3K
Translate
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 ,
Oct 31, 2023 Oct 31, 2023

Did the frame have an object style? If so, the size and position of the object style could be changed.

If not, are the PDF pages imported from one document or many? If it is one 800pp PDF placed into ID, you could use the multipageimporter script to import all pages at once on its own layer and to an appropriate scale. The script is here: https://github.com/mike-edel/ID-MultiPageImporter/releases

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
Translate
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 ,
Oct 31, 2023 Oct 31, 2023
LATEST

Hi @Francesco23262834dw7e , Try this:

 

var v = 2;//the amount in points to crop
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var lnks = app.activeDocument.links.everyItem().getElements();
var f, b;
for (var i = 0; i < lnks.length; i++){
    f= lnks[i].parent.parent;
    f.fit(FitOptions.FRAME_TO_CONTENT) 
    b = f.geometricBounds;
    f.geometricBounds = [b[0]+v, b[1]+v, b[2]-v, b[3]-v];
};   
app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;
Translate
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