Dear Aspose team!
Currently, I'm working on a watermark issue and due to your great code samples, it was an easy thing to create some nice samples.
Although I'm very pleased with the results, there are some advanced things which are not completely clear to me:
1. When I'm setting the font's size by Shape#TextPath.Size, the Font in the watermark seems to be bigger than the Word font size that I would expect, e.g. setting size 48 looks biggger in the watermark than in usual Word text.
Do I have to do some conversions, e.g. by Aspose.Words.ConvertUtil? All things that I tried did not work...
2. How do I have to set the correct Shape width so that the text perfectly fits?
I've done this in a "shot from the hip" way as you can see below - it seems to work fine but I don't know if this works for all fonts. Is there a better or more elegant way? Please keep in mind that the length of the text varies
3. I would like to reproduce the Word watermark features "semitrans" for text and "washout" for image watermarks.
Unfortunately, I did not find any properties in Shape, Image, TextPath etc. Do you know how to realize these features?
Here you find the sample code (TextWatermarkData is our own simple data holder class):
var textWatermarkData = (TextWatermarkData) WatermarkData;
doc = new Document(documentPath);
watermark = new Shape(doc, ShapeType.TextPlainText);
watermark.TextPath.Text = textWatermarkData.Text;
watermark.TextPath.FontFamily = textWatermarkData.Font;
watermark.Fill.Color = textWatermarkData.Color;
watermark.Stroked = false;
watermark.WrapType = WrapType.None;
watermark.BehindText = true;
watermark.TextPath.Size = textWatermarkData.Size;
watermark.Height = textWatermarkData.Size;
//START NOTE: this is a HACK that calculates the required widths for the text
watermark.Width = textWatermarkData.Text.Length * 3 * (watermark.Height/4);
watermark.Rotation = -45;
watermark.Rotation = -90;
If you require further information, please feel free to ask.
Thanks for your efforts and your excellent support,