How do I add text to a tiff file.
Posted: Tue Jul 05, 2011 11:12 am
How do I add text to a tiff file.
// create image collection
ImageCollection images = new ImageCollection();
// create annotation controller associated with image collection
AnnotationController annotations = new AnnotationController(images);
// load TIFF file into collection
images.Add(FileName);
// get annotation collection for selected image
AnnotationCollection imageAnnotations = annotations[images.Count - 1];
// create new annotation
TextAnnotation annoTex = new TextAnnotation();
annoTex.BackColor = Color.Black;
annoTex.Text = "Text";
annoTex.Border = true;
annoTex.FontSizeDependsImageResolution = true;
annoTex.Font = new Font("Arial", 72);
annoTex.Location = new PointF(250, 150);
annoTex.Visible = true;
annoTex.ZOrder = 0;
// add new annotation into annotation collection
imageAnnotations.Add(annoTex);
// specify that annotations must be saved with image collection
images.SetSaveAnnotations(true);
images.SaveAndSwitchSource = true;
// save image collection synchronously to new file
images.SaveSync(_saveFilename);
so it does not work
Thanks.
// create image collection
ImageCollection images = new ImageCollection();
// create annotation controller associated with image collection
AnnotationController annotations = new AnnotationController(images);
// load TIFF file into collection
images.Add(FileName);
// get annotation collection for selected image
AnnotationCollection imageAnnotations = annotations[images.Count - 1];
// create new annotation
TextAnnotation annoTex = new TextAnnotation();
annoTex.BackColor = Color.Black;
annoTex.Text = "Text";
annoTex.Border = true;
annoTex.FontSizeDependsImageResolution = true;
annoTex.Font = new Font("Arial", 72);
annoTex.Location = new PointF(250, 150);
annoTex.Visible = true;
annoTex.ZOrder = 0;
// add new annotation into annotation collection
imageAnnotations.Add(annoTex);
// specify that annotations must be saved with image collection
images.SetSaveAnnotations(true);
images.SaveAndSwitchSource = true;
// save image collection synchronously to new file
images.SaveSync(_saveFilename);
so it does not work
Thanks.