Is there a way to get rid of the border around the font when creating a watermark on a document? The attached picture is a blown up version of the doc file we are using. Code is below that I’m using. I’d like to have the text be all the same color. The only way I can do that is to set the font to black, but that’s too dark. If I set the font to black and turn down the opacity, the border of the text is darker than the fill.
The code is mostly copied from the forum in an attempt to get the feature to work.
Thanks.
WORD.Drawing.Shape watermark = new Aspose.Words.Drawing.Shape(doc, Aspose.Words.Drawing.ShapeType.TextPlainText);
watermark.TextPath.Text = _assay.SampleInfo.Batch;
watermark.TextPath.Size = _reportSettings.WatermarkFontSize;
watermark.TextPath.FontFamily = "Times New Roman";
// watermark.TextPath.FitPath = false;
watermark.TextPath.FitShape = false;
watermark.TextPath.Bold = true;
watermark.Width = 600;
watermark.Height = 300;
watermark.BehindText = true;
watermark.TextPath.Kerning = true;
watermark.TextPath.Shadow = true;
// watermark.Fill.Color = System.Drawing.Color.Green;
watermark.Fill.On = true;
watermark.Fill.Color = System.Drawing.Color.Black;
watermark.Fill.Opacity = 0.5;
watermark.Left = _reportSettings.WatermarkX;
watermark.Top = _reportSettings.WatermarkY;
// watermark.RelativeHorizontalPosition = WORD.Drawing.RelativeHorizontalPosition.Page;
// watermark.RelativeVerticalPosition = WORD.Drawing.RelativeVerticalPosition.Page;
watermark.WrapType = WORD.Drawing.WrapType.None;
watermark.VerticalAlignment = Aspose.Words.Drawing.VerticalAlignment.Center;
watermark.HorizontalAlignment = WORD.Drawing.HorizontalAlignment.Center;
WORD.Paragraph watermarkPar = new WORD.Paragraph(doc);
watermarkPar.AppendChild(watermark);
ArrayList hfTypes = new ArrayList();
hfTypes.Add(WORD.HeaderFooterType.HeaderPrimary);
//Now we should insert watermark into the header of each section of document
foreach (WORD.Section sect in doc.Sections)
{
foreach (WORD.HeaderFooterType hftype in hfTypes)
{
if (sect.HeadersFooters[hftype] == null)
{
//Create new header
if (hftype == WORD.HeaderFooterType.HeaderPrimary ||
hftype == WORD.HeaderFooterType.HeaderFirst && sect.PageSetup.DifferentFirstPageHeaderFooter ||
hftype == WORD.HeaderFooterType.HeaderEven && sect.PageSetup.OddAndEvenPagesHeaderFooter)
{
WORD.HeaderFooter hf = new WORD.HeaderFooter(doc, hftype);
//insert clone of watermarkPar into the header
hf.AppendChild(watermarkPar.Clone(true));
sect.HeadersFooters.Add(hf);
}
}
else
{
sect.HeadersFooters[hftype].AppendChild(watermarkPar.Clone(true));
}
}
}