←Select platform

Save(string,AnnBatesStampComposer) Method

Summary

Saves a Bates stamp composer with its components to a file.

Syntax
C#
VB
C++
Java
public static void Save( 
   string fileName, 
   AnnBatesStampComposer composer 
) 
Public Overloads Shared Sub Save( _ 
   ByVal fileName As String, _ 
   ByVal composer As AnnBatesStampComposer _ 
)  
public static void save(String fileName, AnnBatesStampComposer composer) 
public:  
   static void Save( 
      String^ fileName, 
      AnnBatesStampComposer^ composer 
   ) 

Parameters

fileName
Destination file name to save the data to.

composer
The AnnBatesStampComposer to be saved. This value must not be null.

Example

This example will create Bates stamp composer , save it to file and load it from file again.

C#
VB
using Leadtools.Annotations.Engine; 
using Leadtools.Annotations.Automation; 
using Leadtools.Annotations.Rendering; 
using Leadtools.Annotations.WinForms; 
using Leadtools.Annotations.BatesStamp; 
using LeadtoolsExamples.Common; 
 
public void AnnBatesStampComposer_SaveLoad() 
{ 
   //Create Bates stamp object to be used on our test 
   AnnBatesStamp batesStamp = new AnnBatesStamp(); 
   batesStamp.Elements.Add(new AnnBatesNumber()); 
 
   //Create Bates stamp composer that we want to save and load 
   AnnBatesStampComposer composer = new AnnBatesStampComposer(); 
   //Create new container and attach it to the Bates stamp composer to stamp it. 
   AnnContainer batesStampContainer = new AnnContainer(); 
   composer.TargetContainers.Add(batesStampContainer); 
   composer.Stamps.Add(batesStamp); 
 
   //Print the contents of Bates stamp object 
   Debug.WriteLine(composer.Stamps[0].AsString(batesStampContainer)); // the output will be "000001" 
 
 
   //temp file to save on , if the file is not existing , it will be created on spcefied path 
   string tempFile = Path.Combine(ImagesPath.Path, "temp.xml"); 
 
   //Save the composer to the temp file then load it again 
   AnnBatesStampComposer.Save(tempFile, composer); 
 
   AnnBatesStampComposer loadedComposer = AnnBatesStampComposer.Load(tempFile); 
   loadedComposer.TargetContainers.Add(batesStampContainer); 
 
   //Print the contents of Bates stamp object again to make sure the load is correct. 
   Debug.WriteLine(loadedComposer.Stamps[0].AsString(batesStampContainer)); // the output will be "000001" 
} 
Imports Leadtools 
Imports Leadtools.Annotations.Engine 
Imports Leadtools.Annotations.Automation 
Imports Leadtools.Annotations.Rendering 
Imports Leadtools.Annotations.WinForms 
Imports Leadtools.Annotations.BatesStamp 
Imports LeadtoolsExamples.Common 
 
Public Sub AnnBatesStampComposer_SaveLoad() 
   'Create Bates stamp object to be used on our test 
   Dim batesStamp As AnnBatesStamp = New AnnBatesStamp() 
   batesStamp.Elements.Add(New AnnBatesNumber()) 
 
   'Create Bates stamp composer that we want to save and load 
   Dim composer As AnnBatesStampComposer = New AnnBatesStampComposer() 
   'Create new container and attach it to the Bates stamp composer to stamp it. 
   Dim batesStampContainer As AnnContainer = New AnnContainer() 
   composer.TargetContainers.Add(batesStampContainer) 
   composer.Stamps.Add(batesStamp) 
 
   'Print the contents of Bates stamp object 
   Debug.WriteLine(composer.Stamps(0).AsString(batesStampContainer)) ' the output will be "000001" 
 
 
   'temp file to save on , if the file is not existing , it will be created on spcefied path 
   Dim tempFile As String = Path.Combine(ImagesPath.Path, "temp.xml") 
 
   'Save the composer to the temp file then load it again 
   AnnBatesStampComposer.Save(tempFile, composer) 
 
   Dim loadedComposer As AnnBatesStampComposer = AnnBatesStampComposer.Load(tempFile) 
   loadedComposer.TargetContainers.Add(batesStampContainer) 
 
   'Print the contents of Bates stamp object again to make sure the load is correct. 
   Debug.WriteLine(loadedComposer.Stamps(0).AsString(batesStampContainer)) ' the output will be "000001" 
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