Script who checks - and stop - if text has overset
In this script:
var doc = app.activeDocument;
var mItems=doc.allPageItems;
var len = mItems.length;
// save measurement unit & set measurement unit to mm
//savedUnits = app.scriptPreferences.measurementUnit;
//app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
while(len--){
var mItem = mItems[len];
var mBounds = mItem.geometricBounds;
var mX = getRound(mBounds[1],3);
var mY= getRound(mBounds[0],3);
// fit content
if(mX == 10 && mY == 10){
mItem.fit(FitOptions.CONTENT_TO_FRAME);
}
if(mX == 6.999 && mY == 4.801){
resizeItem(mItem, 240,340)
mItem.move([10, 10]);
mItem.fit(FitOptions.CONTENT_TO_FRAME);
}
}
var doc = app.activeDocument;
var _PDFfile = new File('\\\\C:/test\\' + app.activeDocument.name.replace (/\.indd$/, '.pdf'));
var _PDFExportPreset = app.pdfExportPresets.item('MyJobOptionName');
if (_PDFExportPreset == null){
alert('PDF Export Presets not found');
exit();
}
app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;
doc.exportFile(ExportFormat.pdfType, _PDFfile, false,_PDFExportPreset);
/* round */
function getRound(number, digits) {
digits = (digits) ? Math.pow(10, digits) : 1000;
return Math.round(number * digits) / digits;
}
/* resize object */
function resizeItem(mItem, mWidth,mHeight) {
mBounds = mItem.geometricBounds;
mBounds[3] = mBounds[1] + mWidth;
mBounds[2] =mBounds[0] + mHeight;
mItem.geometricBounds = mBounds;
}
I also need the script to check for overset text.
So something like this.
1. If there is a textbox with overset text the scipt shall stop all further actions in the script and warn about it.
2. If there is no textbox with overset text the script shall just run with all actions.
