Introduction
Note: These options apply to image frames only.
The Frame Options pane in Field Options allows you to assign alternative text (“Alt Text”) that is attached to the frame for PDF export, helping in the creation of accessible PDFs. Using this dialog, you can also specify an ExtendScript that is executed after the frame is populated by EasyCatalog.
Object Export Options
Alt Text
The alternative text applied to the frame is defined using EasyCatalogโs Custom Field commands. For example, to use the contents of the โMy Alt Textโ field, use the following command:
1 | FIELDSTR('My Alt Text') |
This is equivalent to selecting Object > Object Export Options > Custom as the Alt Text source in InDesign
Post Population Script
The Post Population Script runs when a field is tagged to a frame during the final stage of population.
The script receives a set of arguments that vary depending on whether the Scripting Module is installed.
Without the Scripting Module:
1 2 | arguments[0] : The item being populated. arguments[1] : The document object. |
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // Get the target frame frame = arguments[0]; // Get the document var doc = arguments[1]; // Set stroke color to Red frame.strokeColor = doc.swatches.itemByName("Red"); // Set stroke weight to 5 points frame.strokeWeight = 5; // Optional: Set stroke alignment (e.g. centered, inside, or back) frame.strokeAlignment = StrokeAlignment.CENTER_ALIGNMENT; // or .BACK, .INSIDE_ALIGNMENT |
With the Scripting Module installed:
Two additional parameters are passed:
1 2 | arguments[2] : The DataSource object. arguments[3] : The Record object. |
Example:
1 2 3 4 | var frame = arguments[0]; var record = arguments[3]; var stroke = record.fields.item("stroke weight") frame.strokeWeight = stroke.fieldContent; |
For more complex scripts, a script file can be placed in the data sourceโs Scripts folder and referenced with an include directive:
1 | #include "applycolour.jsx" |
Example: Scaling a Barcode
Example script to scale a barcode so it has less whitespace around it:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | var frame = arguments[0]; if (frame.pageItems.length > 0) { var innerFrame = frame.pageItems[0]; var bounds = innerFrame.geometricBounds; var currentWidth = bounds[3] - bounds[1]; // right - left var currentHeight = bounds[2] - bounds[0]; // bottom - top // Set the resize percentage (e.g., 120% for 20% bigger) var resizeFactor = 120 / 100; // Calculate new width and height based on the percentage var newWidth = currentWidth * resizeFactor; var newHeight = currentHeight * resizeFactor; var newBottom = bounds[0] + newHeight; var newRight = bounds[1] + newWidth; // Optional: center the image within the frame innerFrame.geometricBounds = [bounds[0], bounds[1], newBottom, newRight]; frame.fit(FitOptions.CENTER_CONTENT); } |