LEADTOOLS Support
Document
Document SDK Questions
Add annotations programmatically without viewer on multiple pages
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Sunday, June 2, 2013 5:52:26 AM(UTC)
Groups: Registered
Posts: 50
Hi James,
How to add then burn annotations for multi-page document? Each page has its own annotations. For example, page no stamp. I have used the code in your link with one page image for a while. But I can't figure out for muti-page. Someone said that requires one AnnContainer for each page.
#2
Posted
:
Monday, June 3, 2013 4:41:14 AM(UTC)
Groups: Registered, Tech Support
Posts: 179
Our moderator has split your post to a new thread.
The main idea is to loop on all image pages, and on each page load the related annotation file then burn it to the image.
I have modified the project to load Multipage tiff and burn the same annotation file on all pages.
In your case, you may need to change the annotation file for each page since you said each page has its own annotation.
Mohamed Abedallah
Developer Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Thursday, June 6, 2013 6:06:15 AM(UTC)
Groups: Registered
Posts: 50
Thanks for the code. I can use it as my last resort. What I am looking for also is the ability to be able adjust stamp position for each page. so Add and Burn will be seperate operation. Is that doable? Thanks!
#4
Posted
:
Friday, June 7, 2013 7:38:12 AM(UTC)
Groups: Registered
Posts: 50
I realized my 2nd post is deviating from the subject in terms of "Without viewer". To be able to adjust annotation position by user, viewer has to be used. I will rephrase my question. Can this be done? Showing multi-page image on RasterImage viewer, then let user add text stamp on each page, user can adjust the stamp content and position for each page. once user is happy with all stamps on all pages, user will burn the stamps into the images. I hope this is clear. Thanks.
#5
Posted
:
Sunday, June 9, 2013 4:56:32 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
I am attaching a small C# 2010 project that shows how you can load\view a multipage TIFF image, draw text annotations on each page, burn these objects and then save the result to a separate file.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#6
Posted
:
Sunday, June 9, 2013 10:22:52 AM(UTC)
Groups: Registered
Posts: 50
Thanks!! I am getting close with your code. But I am not familar with AnnAutomatiom. How to add a Text stamp once the button "Draw Text" is clicked? With your code, user has to click where stamp is needed to be added. I have a AnnTextObject defined already with position and text etc. Can it be added once "Draw Text" is clicked?
#7
Posted
:
Sunday, June 9, 2013 11:19:04 PM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
I modified the project so that the user can draw the annotation text object directly after clicking the "Draw Text" button.
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#8
Posted
:
Monday, June 10, 2013 3:29:22 AM(UTC)
Groups: Registered
Posts: 50
Hi Maen, Sorry to bug you even more. Is it possible to add page no stamp for all pages when "Draw Text" button is clicked only once? I guess I can combine code of Draw Text, Click Next then Draw Text, click Next, etc.. But I am not sure if that is going work or that is ideal way.
#9
Posted
:
Monday, June 10, 2013 4:27:36 AM(UTC)
Groups: Registered, Tech Support
Posts: 1,326
Was thanked: 1 time(s) in 1 post(s)
You need to change the code of the "Draw Text" button as follows:
+---------------+
private void button1_Click(object sender, EventArgs e)
{
for (int i = 1; i <= rasterImageViewer1.Image.PageCount; i++)
{
rasterImageViewer1.Image.Page = i;
if (annAuto1.Container.Objects.Count > 0)
annAuto1.Container.Objects.Clear();
AnnTextObject TextObject = new AnnTextObject();
TextObject.Pen = new AnnPen(Color.Red, new AnnLength(3));
TextObject.TextColor = Color.White;
TextObject.Text = "Page:" + rasterImageViewer1.Image.Page.ToString();
TextObject.Brush = null;
TextObject.Font = new AnnFont("Arial", new AnnLength(10, AnnUnit.Point), FontStyle.Regular);
TextObject.EdgeMargin = AnnLength.Empty;
TextObject.Alignment = StringAlignment.Center;
TextObject.LineAlignment = StringAlignment.Center;
TextObject.TextRotate = AnnTextRotate.Rotate0;
TextObject.Bounds = new AnnRectangle(rasterImageViewer1.Image.Width / 2, rasterImageViewer1.Image.Height - 100, 90, 90, AnnUnit.Pixel);
annAuto1.Container.Objects.Add(TextObject);
SaveAnn(sender, e);
rasterImageViewer1.Refresh();
}
}
+---------------+
Thanks,
Maen Badwan
LEADTOOLS Technical Support
#10
Posted
:
Sunday, June 16, 2013 10:37:05 AM(UTC)
Groups: Registered
Posts: 50
Thanks for help! I used your code and then changed to use one memorystream per page. That worked well for my purpose.
LEADTOOLS Support
Document
Document SDK Questions
Add annotations programmatically without viewer on multiple pages
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.