AnnBatesStampComposer is the main part for Bates stamping operation as it connects annotations containers with Bates stamp objects.
public class AnnBatesStampComposer : IDisposable
Public Class AnnBatesStampComposer
public class AnnBatesStampComposer
public:
ref class AnnBatesStampComposer : IDisposable
Use this composer to add target containers to apply Bates stamps to.
It allows the addition of AnnBatesStamp objects. Also this composer have ability to save and load the Bates stamp list.
This example will create Bates stamp object with multiple elements then use the composer to attach the Bates stamp to target container.
using Leadtools.Annotations.Engine;
using Leadtools.Annotations.Automation;
using Leadtools.Annotations.Rendering;
using Leadtools.Annotations.WinForms;
using Leadtools.Annotations.BatesStamp;
public void AnnBatesStampComposer_AnnBatesStampComposer()
{
//Create AnnBatesStamp and set its properties
AnnBatesStamp batesStamp = new AnnBatesStamp();
batesStamp.Font = new AnnFont("Arial", 12);
batesStamp.Foreground = AnnSolidColorBrush.Create("Red");
batesStamp.HorizontalAlignment = AnnHorizontalAlignment.Center;
batesStamp.VerticalAlignment = AnnVerticalAlignment.Center;
batesStamp.Logo.Angle = 45;
batesStamp.Logo.Font = new AnnFont("Arial", 14);
batesStamp.Logo.Opacity = 0.5;
batesStamp.Logo.StretchLogo = true;
batesStamp.Logo.Picture = new AnnPicture(Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"));
//Add some elements to Bates stamp elements list
batesStamp.Elements.Add(new AnnBatesNumber());
batesStamp.Elements.Add(AnnBatesText.Create(" "));
batesStamp.Elements.Add(AnnBatesText.Create(" This is text element"));
//Create AnnBatesStampComposer instance and add the created Bates stamp to it
AnnBatesStampComposer batesStampComposer = new AnnBatesStampComposer();
//Set the rendering engine
AnnBatesStampComposer.RenderingEngine = new AnnWinFormsRenderingEngine();
batesStampComposer.Stamps.Add(batesStamp);
//Use the main automation object for your application instead of _automation we used here
AnnAutomation automation = _automation;
AnnContainer mainContainer = automation.Container;
//Create Bates stamp container, set its size and mapper and attach it to the composer
AnnContainer batesStampContainer = new AnnContainer();
batesStampContainer.Size = mainContainer.Size;
batesStampContainer.Mapper = mainContainer.Mapper.Clone();
//Apply Bates Stamp to our container
batesStampComposer.TargetContainers.Add(batesStampContainer);
//insert the Bates stamp container below all other containers in the automation
automation.Containers.Insert(0, batesStampContainer);
//print the content of this Bates stamp
Debug.WriteLine(batesStamp.AsString(batesStampContainer)); // the output will be "000001 This is text element"
//Render the containers
automation.Invalidate(LeadRectD.Empty);
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";
}
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_AnnBatesStampComposer()
'Create AnnBatesStamp and set its properties
Dim batesStamp As AnnBatesStamp = New AnnBatesStamp()
batesStamp.Font = New AnnFont("Arial", 12)
batesStamp.Foreground = AnnSolidColorBrush.Create("Red")
batesStamp.HorizontalAlignment = AnnHorizontalAlignment.Center
batesStamp.VerticalAlignment = AnnVerticalAlignment.Center
batesStamp.Logo.Angle = 45
batesStamp.Logo.Font = New AnnFont("Arial", 14)
batesStamp.Logo.Opacity = 0.5
batesStamp.Logo.StretchLogo = True
batesStamp.Logo.Picture = New AnnPicture(Path.Combine(ImagesPath.Path, "cannon.jpg"))
'Add some elements to Bates stamp elements list
batesStamp.Elements.Add(New AnnBatesNumber())
batesStamp.Elements.Add(AnnBatesText.Create(" "))
batesStamp.Elements.Add(AnnBatesText.Create(" This is text element"))
'Create AnnBatesStampComposer instance and add the created Bates stamp to it
Dim batesStampComposer As AnnBatesStampComposer = New AnnBatesStampComposer()
'Set the rendering engine
AnnBatesStampComposer.RenderingEngine = New AnnWinFormsRenderingEngine()
batesStampComposer.Stamps.Add(batesStamp)
'Use the main automation object for your application instead of _automation we used here
Dim automation As AnnAutomation = _automation
Dim mainContainer As AnnContainer = automation.Container
'Create Bates stamp container, set its size and mapper and attach it to the composer
Dim batesStampContainer As AnnContainer = New AnnContainer()
batesStampContainer.Size = mainContainer.Size
batesStampContainer.Mapper = mainContainer.Mapper.Clone()
'Apply Bates Stamp to our container
batesStampComposer.TargetContainers.Add(batesStampContainer)
'insert the Bates stamp container below all other containers in the automation
automation.Containers.Insert(0, batesStampContainer)
'print the content of this Bates stamp
Debug.WriteLine(batesStamp.AsString(batesStampContainer)) ' the output will be "000001 This is text element"
'Render the containers
automation.Invalidate(LeadRectD.Empty)
End Sub
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document