Hi,
I’m trying to set up Underline and StrikeOut props on watermark text, but it doesn’t seem to work as expected. Here is my code:
var wmText = “First Line\nSecond Line\nThird Line”;
var lines = wmText.Split(new string[] { “\r\n”, “\r”, “\r”, “\n”, “\n” }, StringSplitOptions.RemoveEmptyEntries);
var wmFontSize = 20;
var document = new Document(filename);
var artifact = new WatermarkArtifact();
artifact.SetLinesAndState(lines, new TextState()
{
FontSize = wmFontSize,
ForegroundColor = Color.Red,
Font = FontRepository.FindFont(“Courier”),
FontStyle = FontStyles.Italic | FontStyles.Bold,
Underline = true,
StrikeOut = true
});
artifact.ArtifactHorizontalAlignment = HorizontalAlignment.Center;
artifact.ArtifactVerticalAlignment = VerticalAlignment.Center;
artifact.Rotation = 0;
artifact.Opacity = 0.8;
artifact.IsBackground = true;
foreach (var page in document.Pages)
{
page.Artifacts.Add(artifact);
}
document.Save(resultFile);
Regards