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

Markup dimensions in InDesign file

Explorer ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

Is there a way to markup a document in InDesign with dimensions?

Much like you can do in a drafting program, like AutoCAD.

See sample screenshot below (made in AutoCAD).

 

GUID-981465FF-9076-41CF-83D0-189A1130DC6E.png

TOPICS
How to

Views

10.5K

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

correct answers 2 Correct answers

Explorer , Nov 21, 2019 Nov 21, 2019

I asked the question and discovered the answer!

The script below is the correct one.

 

Copy and paste the following lines in notepad and save as"labelImageSize.jsx" (must include the .jsx extension, obviosuly). Also, make sure you have "Arial" font installed on your machine, otherwise replace "Arial" with a font you have installed.

 

Finally, by default the dimensions won't print. If you want them to; check the "Print Layer" option within "ImageLabel" layer.

 

Annotation 2019-11-21 134158.png

 

SCRIPT STARTS AFTER THIS LINE:

-----------

...

Votes

Translate

Translate
Enthusiast , May 11, 2021 May 11, 2021

I made a script for this, released yesterday.

https://www.marspremedia.com/software/indesign/dimensions-indesign

Made a video too

https://youtu.be/GD9nTcIDino

Votes

Translate

Translate
Community Expert ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

There isn't a native feature that offers dimensioning in InDesign, and if someone makes a plugin, I haven't seen it.

 

You'd have better luck if it was Illustrator.

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 ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

Thanks.

On second thought, I just came across this script:

https://www.drscripto.com/indesign-add-measurements/

I'll have to try it, but it seems that it would be a solution.

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
Participant ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

This isn't exactly what you are looking for, but a user in the InDesign Forum wrote a script for me for labeling dimensions of a selected object.

https://indesignsecrets.com/topic/script-to-label-selection-with-height-and-width 

 

And in that thread, there is mention of a plug in, but I never tried it since the solution provided for me was excellent.

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 ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

Thanks, "pedley_s".

I've tried one of the solutions, but got an error (see screenshot) when running the script.

Anyone know what that means? I'm running latest version; InDesign 2020, btw.

Thanks.

Annotation 2019-11-21 130929.png

JavaScript Error!

Error Number: 30477
Error String: Invalid value for set property 'appliedParagraphStyle'. Expected ParagraphStyle or String, but received nothing.

Engine: main
File: C:\Users\ [my user name] \AppData\Roaming\Adobe\InDesign\Version 15.0-ME\en_IL\Scripts\Scripts Panel\labelImageSize.jsx
Line: 7
Source: app.doScript(labelItem, ScriptLanguage.JAVASCRIPT, app.selection[0], UndoModes.ENTIRE_SCRIPT, "Label Image Size");

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 ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

I asked the question and discovered the answer!

The script below is the correct one.

 

Copy and paste the following lines in notepad and save as"labelImageSize.jsx" (must include the .jsx extension, obviosuly). Also, make sure you have "Arial" font installed on your machine, otherwise replace "Arial" with a font you have installed.

 

Finally, by default the dimensions won't print. If you want them to; check the "Print Layer" option within "ImageLabel" layer.

 

Annotation 2019-11-21 134158.png

 

SCRIPT STARTS AFTER THIS LINE:

----------------------------------------------

 

//DESCRIPTION:Label image with its size
// Jongware, 13-Jan-2012
// No Guarantees, Etc.

if (app.documents.length && app.selection.length == 1 && app.selection[0].hasOwnProperty("paths"))
{
if (app.version < 6)
labelItem(app.selection[0]);
else
app.doScript(labelItem, ScriptLanguage.JAVASCRIPT, app.selection[0], UndoModes.ENTIRE_SCRIPT, "Label Image Size");
} else
{
alert ("No valid selection.\nPlease select one single object with the black arrow before running this script.");
}

function labelItem (item)
{
// Save current selected layer because adding one will make it active!
activeLayer = app.activeDocument.layoutWindows[0].activeLayer;
// Make sure the layer "ImageSize" exists
try {
app.activeDocument.layers.add({name:"ImageLabel", ignoreWrap:true, layerColor: [90,192,90], printable: false});
} catch (_) { }
reportLayer = app.activeDocument.layers.item("ImageLabel");

// Make sure the swatch "ImageGreen" exists
try {
app.activeDocument.colors.add({name:"ImageLabel", space:ColorSpace.RGB, colorValue:[90,192,90], colorModel:ColorModel.PROCESS});
} catch (_) { }
reportGreen = app.activeDocument.swatches.item("ImageLabel");

// Make sure the paragraph style "ImageSize" exists
try {
app.activeDocument.paragraphStyles.add({name:"ImageLabel", appliedFont:"Arial", pointSize:12, fillColor:reportGreen, justification: Justification.CENTER_ALIGN});
} catch (_) { }
reportStyle = app.activeDocument.paragraphStyles.item("ImageLabel");

// Make sure measurement units are in inches
hmmu = app.activeDocument.viewPreferences.horizontalMeasurementUnits;
vmmu = app.activeDocument.viewPreferences.verticalMeasurementUnits;
app.activeDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.INCHES_DECIMAL;
app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES_DECIMAL;
// .. and Smart Quotes is Off
sqt = app.activeDocument.textPreferences.typographersQuotes;
app.activeDocument.textPreferences.typographersQuotes = false;
// Save all of the previous settings to be able to restore them later 🙂

// fetch width and height for the numbers, left and bottom for the lines
gb = item.geometricBounds;
// gb now holds [ top, left, bottom, right ] values -- get shorthand values
top = gb[0];
left = gb[1];
bottom = gb[2];
right = gb[3];

width = Math.round(Math.abs(right - left)*1000)/1000;
height= Math.round(Math.abs(bottom - top)*1000)/1000;

// Retrieve the current page.
// Actually, in CS5 and newer, page items have a property for this (parentPage),
// but I don't have that one near, and it's also nicer to make it work in CS4
// (and possibly even in older versions).
pg = item.parent;
while (1)
{
if (pg instanceof InsertionPoint)
pg = pg.parentTextframes[0];
if (pg instanceof Document || pg instanceof Spread || pg instanceof Page)
break;
pg = pg.parent;
}
// Draw text frame #1: Height
// Put it at the left of the selection, 0.5" wide and 0.2" off the left side
frh = pg.textFrames.add(reportLayer, {geometricBounds:[ top, left - 0.7, top + height, left - 0.2 ],
textFramePreferences: {verticalJustification: VerticalJustification.CENTER_ALIGN,
ignoreWrap: true } });
// ... and put text into it.
frh.insertionPoints[0].appliedParagraphStyle = reportStyle;
frh.contents = String(height)+'"';

// Draw text frame #2: Width
// Put it at 0.2" off the bottom of the selection, 0.25" high, full width for convenience
frw = pg.textFrames.add(reportLayer, {geometricBounds:[ bottom + 0.2, left, bottom + 0.2 + 0.25, left + width ],
textFramePreferences: {verticalJustification: VerticalJustification.CENTER_ALIGN,
ignoreWrap: true } });
// ... and put text into it.
frw.insertionPoints[0].appliedParagraphStyle = reportStyle;
frw.contents = String(width)+'"';

// Add vertical (height) line
lnh = pg.graphicLines.add (reportLayer, {strokeColor:reportGreen, strokeWeight:0.5});
// It appears in a default position so move it to the right one
lnh.paths[0].entirePath = [ [left - 0.15, top ], [left - 0.15, bottom ] ];
// add top stroke; it's 0.05" wide so offset left and right with 0.025"
lnh.paths.add ({ entirePath:[ [left-0.15 - 0.025, top ], [left-0.15 + 0.025, top] ] });
// add bottom stroke
lnh.paths.add ({ entirePath:[ [left-0.15 - 0.025, bottom ], [left-0.15 + 0.025, bottom] ] });

// Add horizontal (width) line
lnw = pg.graphicLines.add (reportLayer, {strokeColor:reportGreen, strokeWeight:0.5});
// Again we move it to the right position
lnw.paths[0].entirePath = [ [left, bottom + 0.15 ], [right, bottom + 0.15 ] ];
// Add end caps as above
lnw.paths.add ({ entirePath:[ [left, bottom+0.15 - 0.025 ], [left, bottom+0.15 + 0.025] ] });
lnw.paths.add ({ entirePath:[ [right, bottom+0.15 - 0.025 ], [right, bottom+0.15 + 0.025] ] });

// At this point we added four items: 2 text frames and 2 graphic lines.
// Group them together for convenience
app.activeDocument.groups.add ( [ frh, frw, lnh, lnw ] );

// Restore old layer selection
app.activeDocument.layoutWindows[0].activeLayer = activeLayer;

// Restore previous global settings
app.activeDocument.viewPreferences.horizontalMeasurementUnits = hmmu;
app.activeDocument.viewPreferences.verticalMeasurementUnits = vmmu;
app.activeDocument.textPreferences.typographersQuotes = sqt;

}

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 ,
Nov 21, 2019 Nov 21, 2019

Copy link to clipboard

Copied

Hi mosheyfri,

I think the answer is in the linked thread.

Somewhere in the script's code a font is defined to be used for a new paragraph style.

That font is not installed with your system. Could be "Helvetica".

So change that to e.g. "Arial". You are on Windows, so "Arial" should be available.

 

Regards,
Uwe Laubender

( ACP )

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
Participant ,
Jun 07, 2020 Jun 07, 2020

Copy link to clipboard

Copied

Can someone help change the ft units to mm?

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
Enthusiast ,
May 11, 2021 May 11, 2021

Copy link to clipboard

Copied

I made a script for this, released yesterday.

https://www.marspremedia.com/software/indesign/dimensions-indesign

Made a video too

https://youtu.be/GD9nTcIDino

William Campbell

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
Participant ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

Thanks. is there any similiar script for Illustrator?

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
Enthusiast ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

In progress now. Uses same interface with a few changes. I will post here and in Illustrator section when done.

 

William Campbell

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
Participant ,
May 13, 2021 May 13, 2021

Copy link to clipboard

Copied

Thanks. i'm still following this thread. 🙂

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
Enthusiast ,
Jun 17, 2021 Jun 17, 2021

Copy link to clipboard

Copied

LATEST

Illustrator version is done. I made a post about it in the Illustrator section:
https://community.adobe.com/t5/illustrator/new-script-dimensions-illustrator/m-p/12120192#M279896

 

Download the new script here: http://www.marspremedia.com/software/illustrator/dimensions-illustrator

 

Thank you for your interest and support

 

William Campbell

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 Beginner ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

Your script is very helpfull. It helps me with my daily work.

Would it be possible to generate just the measurement lines without the text?

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
Enthusiast ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

@Mick5C8B  Thanks. I suppose without text is possible, but I'm having a hard time imagining the usefulness. If just lines without indication of the dimension...? Perhaps you could elaborate on how it would be useful to you. Is the idea to create the text manually?

 

William Campbell

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 Beginner ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

Hi Will,

 

Thanks fort your reply. It's hard to explain, but I have to create lots instruction papers for packaging, I'm trying to create a workflow which is automated as far as possible.

 

The dimensions will be automatically filled in when I type them in elsewhere in the document. That way I just need the responsive measurement lines which your script gerenates perfectly.

 

Hope my explanation is not too vague.

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
Enthusiast ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

@Mick5C8B   Understood. But this sounds like a case of customization, which is how I'd approach it. As a developer I try to avoid making solutions that stuff in myriad additions to address every edge case. Usually it's better to adapt the script to the specialized need. I'm reminded of the old gag screenshot of an imagined future version of MS Word, where the toolbar takes up 90% of the window with a small area at the bottom to actually do work. That gave up many laughs back in the day. Anyway, if a customized adaptation, I'd imagine you also don't need other script features like distance, radius, and angle (or maybe you do). It would not be difficult to create a custom version of the script that makes only dimension lines and without text. And while at it, do it to every element on the page in one click. Or perhaps only certain elements. Anything is possible. You should contact me directly, either at the address on the script interface, or my website contact page. We can continue in email to sort out the details of your specialized need, and I can whip up something custom. Thanks.

 

William Campbell

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
Enthusiast ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

@Mick5C8B  I have a new version 2.0 that provides your request, along with other fixes and new features. Download from the web page:

https://www.marspremedia.com/software/indesign/dimensions-indesign

Either "Lines" or "Text" can now be un-checked, and either won't be drawn.

@Laubender  About text on another layer... I considered this, but then realized it would break up the group. So not the best solution, as it creates another annoyance, having the elements no longer grouped. The check boxes should do the trick.

Other big improvements: text frames now auto-size (should have to begin with!); can set text swatch independent of line swatch; option to lengthen extension lines into element; can define prefix for corner radius; lots of other little fixes.

I want to thank everyone for the fabulous input to the project, here and in private messages. Users have helped me make a real gem. Thank you all!

 

William Campbell

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 Beginner ,
Jun 07, 2021 Jun 07, 2021

Copy link to clipboard

Copied

Works like a charm. Thank you so much!

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 ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

"Would it be possible to generate just the measurement lines without the text?"

 

Hi Mick5C8B,

wouldn't it be easy to remove the text in one go with a simple Find/Change action?

They all have one paragraph style in common. By default its name is "Dimensions".

 

Ok. You could do it this way, run this script code on the document where you added a layer named "Dimensions":

app.documents[0].layers.itemByName("Dimensions").groups.everyItem().textFrames.everyItem().remove();

 

To William,

whalt could help: Build the text frames for the text on an extra layer.

That layer for the text frames could be easily made invisible or removed.

 

Regards,
Uwe Laubender

( ACP )

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
Enthusiast ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

@Laubender  The extra layer could work. A good solution. I'll consider it. Thanks.

 

William Campbell

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 Beginner ,
Jun 02, 2021 Jun 02, 2021

Copy link to clipboard

Copied

Thanks for your reply, I will try this!

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 ,
Jun 03, 2021 Jun 03, 2021

Copy link to clipboard

Copied

Hi Mick,

before you try anything with my one line of code, make sure that layer "Dimensions" exists AND make sure that there are still groups on the layer. If there are no groups, my script will run into an error.

If there are groups and you already removed a text frame from one or more of the groups, InDesign could even crash. So: be careful!

 

Regards,
Uwe Laubender

( ACP )

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