AnnBatesStampTranslator Object

Summary

AnnBatesStampTranslator defines a translator that converts the Bates stamp elements to a string expression. Converts from a string expression to Bates stamp elements that can be saved and loaded using AnnBatesStampComposer.

Syntax

JavaScript Syntax
function lt.Annotations.Documents.AnnBatesStampTranslator 
TypeScript Syntax
class lt.Annotations.Documents.AnnBatesStampTranslator() 

Remarks

This class is used by AnnBatesStampComposer when applying save/load. It can also convert Bates stamp elements to/from a string.

A text expression is composed of the following symbols: To convert AnnBatesDateTime to a string, the expression will appear in the following formatted order: The starting expression ExpressionStartSymbol + the name of the type AnnBatesDateTime + the separating symbol ExpressionSeparatingSymbol + the time format as UTC or local + the separating symbol ExpressionSeparatingSymbol + the date format + ending symbol ExpressionEndSymbol. For example:

{{BatesDateTime*Local*MM/dd/yyyy}}
To convert AnnBatesNumber to a string, the expression will appear in the following order: The starting expression ExpressionStartSymbol + the name of the type AnnBatesNumber + the separating symbol ExpressionSeparatingSymbol + the number of digits + the separating symbol ExpressionSeparatingSymbol + all condition digits represented by 0 or 1 + the separating symbol ExpressionSeparatingSymbol + start number + separating symbol ExpressionSeparatingSymbol + auto increment condition which are represented by 0 or 1 + the separating symbol ExpressionSeparatingSymbol + a prefix text + the separating symbol ExpressionSeparatingSymbol + a suffix text + the end symbol ExpressionEndSymbol. For example:
{{BatesNumber*6*1*1*1*before*after}}
In this instance, the type is Bates stamp number with 6 digits, start is set to use all digits, and set to start from 1 with auto increment, the prefix text is "before" and the suffix text is "after". This expression produces: "before000001after". If the text expression does not conform to the format of either AnnBatesDateTime or AnnBatesNumber, then it is an AnnBatesText element. An example for an AnnBatesText is "This is some text". Provided below is an example of different Bates stamp elements that are converted to a string using AnnBatesStampTranslator:
{{BatesDateTime*Local*MM/dd/yyyy}} {{BatesNumber*6*1*1*1*before*after}} This is some text
. This expression renders as "01/11/1111 before000001after This is some text".

Example

This example translates Bates stamp elements to a string expression, and then loads it again.

JavaScript Example
example: function SiteLibrary_DefaultPage$example() { 
   //Create Bates stamp translator instance 
   var translator = new lt.Annotations.Documents.AnnBatesStampTranslator(); 
 
   //Create some Bates stamp elements to test on translator 
   var batesDateTime = new lt.Annotations.Documents.AnnBatesDateTime(); 
   batesDateTime.currentDateTime = new Date(); 
 
   var batesNumber = new lt.Annotations.Documents.AnnBatesNumber(); 
   batesNumber.autoIncrement = true; 
   batesNumber.startNumber = 3; 
   batesNumber.numberOfDigits = 9; 
   batesNumber.prefixText = "beforeText"; 
   batesNumber.suffixText = "afterText"; 
   batesNumber.useAllDigits = true; 
 
   var batesText = lt.Annotations.Documents.AnnBatesText.create("This is test"); 
 
   var elements = [batesDateTime, batesNumber, batesText]; 
   var elementsExpression = translator.writeElementsToString(elements); 
 
   //Print the expression  
   alert(elementsExpression); // the output will be "{{BatesDateTime*Local*}}{{BatesNumber*9*1*3*1*beforeText*afterText}}This is test" 
 
   //Load the Bates stamp elements from the expression again 
   var elements = translator.readFromString(elementsExpression); 
 
   //Print the count of loaded elements to make sure the load is correct 
   alert(elements.length); // the output will be "3" 
} 

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Documents Assembly