←Select platform

AnnBatesStampTranslator Class

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
C#
VB
C++
Java
public class AnnBatesStampTranslator 
Public Class AnnBatesStampTranslator  
public class AnnBatesStampTranslator 
public: 
   ref class 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.

C#
VB
using Leadtools.Annotations.Engine; 
using Leadtools.Annotations.BatesStamp; 
using LeadtoolsExamples.Common; 
 
public void AnnBatesStampTranslator_AnnBatesStampTranslator() 
{ 
   //Create Bates stamp translator instance 
   AnnBatesStampTranslator translator = new AnnBatesStampTranslator(); 
 
   //Create some Bates stamp elements to test on translator 
   AnnBatesDateTime batesDateTime = new AnnBatesDateTime(); 
   batesDateTime.CurrentDateTime = DateTime.Now; 
 
   AnnBatesNumber batesNumber = new AnnBatesNumber(); 
   batesNumber.AutoIncrement = true; 
   batesNumber.StartNumber = 3; 
   batesNumber.NumberOfDigits = 9; 
   batesNumber.PrefixText = "beforeText"; 
   batesNumber.SuffixText = "afterText"; 
   batesNumber.UseAllDigits = true; 
 
   AnnBatesText batesText = AnnBatesText.Create("This is test"); 
 
   string elementsExpression = translator.WriteElementsToString(new IAnnBatesElement[] { batesDateTime, batesNumber, batesText }); 
 
   //Print the expression  
   Debug.WriteLine(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 
   IAnnBatesElement[] elements = translator.ReadFromString(elementsExpression); 
 
   //Print the count of loaded elements to make sure the load is correct 
   Debug.WriteLine(elements.Length); // the output will be "3" 
} 
Imports Leadtools.Annotations.Engine 
Imports Leadtools.Annotations.BatesStamp 
Imports LeadtoolsExamples.Common 
 
Public Sub AnnBatesStampTranslator_AnnBatesStampTranslator() 
   'Create a Bates stamp translator instance 
   Dim translator As AnnBatesStampTranslator = New AnnBatesStampTranslator() 
 
   'Create some Bates stamp elements to test on translator 
   Dim batesDateTime As AnnBatesDateTime = New AnnBatesDateTime() 
   batesDateTime.CurrentDateTime = DateTime.Now 
 
   Dim batesNumber As AnnBatesNumber = New AnnBatesNumber() 
   batesNumber.AutoIncrement = True 
   batesNumber.StartNumber = 3 
   batesNumber.NumberOfDigits = 9 
   batesNumber.PrefixText = "beforeText" 
   batesNumber.SuffixText = "afterText" 
   batesNumber.UseAllDigits = True 
 
   Dim batesText As AnnBatesText = AnnBatesText.Create("This is test") 
 
   Dim elementsExpression As String = translator.WriteElementsToString(New IAnnBatesElement() {batesDateTime, batesNumber, batesText}) 
 
   'Print the expression  
   Debug.WriteLine(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 
   Dim elements As IAnnBatesElement() = translator.ReadFromString(elementsExpression) 
 
   'Print the count of loaded elements to make sure the load is correct 
   Debug.WriteLine(elements.Length) ' the output will be "3" 
End Sub 

Requirements

Target Platforms

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.BatesStamp Assembly