createRegion()

This method sets the physical coordinates of the region object. The region is available when setting document boundaries using a script (see region).

PDF and Text: createRegion(x1, y1, x2, y2)

Creates a region from the data, using the specified left (x1), top (y1), right (x2) and bottom (y2) parameters, expressed in characters for a text file or in millimeters for a PDF file.

x1

Double that represents the left edge of the region.

y1

Double that represents the top edge of the region.

x2

Double that represents the right edge of the region.

y2

Double that represents the bottom edge of the region.

Example

The following script attempts to match ((n,m)) or ((n)) against any of the strings in the specified region and if it does, a document boundary is set.

var myRegion = region.createRegion(170,25,210,35);
var regionStrings=boundaries.get(myRegion);
if (regionStrings) {
for (var i=0;i<regionStrings.length; i++) {
if (regionStrings[i].match(/(\({2}n,*m*\){2})​/gi)){
boundaries.set();
}
}
}

(The match() function expects a regular expression; see w3schools.)

CSV or database: createRegion(columnName)

Creates a region from the data in a CSV file, using the specified columnName parameter.

columnName

String containing the name of the column where the region is to be created.

Example

This script checks the first value in a certain column. If it is not the same value as in the previous record(s), a document boundary is set.

if(!(boundaries.Eof || boundaries.Bof)){
var recordValue = boundaries.get(region.createRegion('ID'))[0];
if(!(recordValue==boundaries.getVariable('lastValue'))){
boundaries.setVariable('lastValue',recordValue);
boundaries.set(0);
}
}
 
  • Last Topic Update: 27, June, 2017 06:10 AM
  • Last Published: 23, May, 2019 01:55 PM