Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, November 19, 2014 8:14:39 PM(UTC)

arg  
arg

Groups: Registered
Posts: 4


I scaned images in my app, and show in RasterImageViewer.

I want to add text to image and save in it.

How to add text to image in RasterImageViewer?
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, November 21, 2014 12:21:52 PM(UTC)

JustinM  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Arg,

What version of LEADTOOLS are you currently using? Also, which framework are you working in? If you are working with CDLL, C++ Class Library, or Winforms you can use the GDI to write text directly to the image.
 
#3 Posted : Friday, November 21, 2014 6:45:45 PM(UTC)

arg  
arg

Groups: Registered
Posts: 4


I uae :
LEADTOOLS 18
.net 4.5
wpf
 
#4 Posted : Sunday, November 23, 2014 12:36:44 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

You can programmatically add a text annotation object to the image by using the following code:
============
AnnTextObject text = new AnnTextObject();
text.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Red"), LeadLengthD.Create(2));
text.Font = new AnnFont("Arial", 2);
text.Font.FontStyle = AnnFontStyle.Normal;
text.Font.FontWeight = AnnFontWeight.Bold;
text.Font.FontStretch = AnnFontStretch.Normal;
text.TextForeground = AnnSolidColorBrush.Create("yellow");
text.Font.TextDecoration = AnnTextDecorations.Underline;
text.Fill = AnnSolidColorBrush.Create("transparent");
LeadRectD TextRect  = new LeadRectD(10,10,200,200);
text.Rect = _activeAutomation.Container.Mapper.RectToContainerCoordinates(TextRect);
text.Text = "This TEXT is for Test";
text.HorizontalAlignment = AnnHorizontalAlignment.Center;
text.VerticalAlignment = AnnVerticalAlignment.Center;
text.TextRotate = AnnTextRotate.Rotate0;
_activeAutomation.Container.Children.Add(text);
UpdateLayout();
_activeAutomation.Invalidate(LeadRectD.Empty);
============

After this, you can burn the annotation object to the image by using the AnnWPFRenderingEngine.BurnToRectWithDpi() method.
For a sample code, please refer to the C# WPF annotation demo that ships with the LEADTOOLS v18 SDK. You can find the demo's source code here:
[LEADTOOLS 18 folder]\Examples\DotNet3\CS\AnnotationsDemo
Specially check the code under the _miAnnotationsRealize_Click event.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.062 seconds.