Page 1 of 1

Stamping Multiple Annotations

Posted: Tue Sep 22, 2009 6:27 pm
by Wanderer
I only want to stamp one annotation per page, where it shows on the top left hand corner. But I have many pages I would like to stamp, I'm running to many errors.

I run th is method 'bannerImage()' in a loop. The only problems are that the process is slow and that it won't work if I don't turn the exceptions off. Is there any way to have this working without clearing the images everytime?
Perhaps just annotating each image separately without clearing it and saving it all at the end. Ultimately I need to print these.

Thanks,
Wanderer

public void bannerImage(string stampedText, string input, string output, int stampedImage)
{
annotations = annotatedTbViewer.Annotations;
stamp = new StampAnnotation();

annotatedTbViewer.Images.Insert(0, input);
stamp.Text = stampedText;
stamp.StampColor = Color.Red;
stamp.Rotation = 0;
stamp.Border = false;
//stamp.Location = new PointF(annotations.Images[0].Width / 2, annotations.Images[0].Height / 2);
//stamp.Size = new SizeF(annotations.Images[0].Width / 3 * 2, annotations.Images[0].Height / 5);
stamp.Location = new PointF(annotations.Images[0].Width / 4, 100);
stamp.Size = new SizeF(800, 100);

annotations[0].Add(stamp);

try
{
annotations.MergeImageWithAnnotations(0);
}
catch
{
}

annotatedTbViewer.Images[0].SaveWithAnnotations(output);
annotatedTbViewer.Images.Clear();
annotationViewer1.Images.Clear();
}

Re: Stamping Multiple Annotations

Posted: Wed Sep 23, 2009 8:15 am
by Alex
Hello,

Please read the description of the AnnotationController.MergeImageCollectionWithAnnotations method in the documentation.

Best regards, Alexander