C2021-019: Override Watermark Text and Color
This commit is contained in:
@@ -942,6 +942,12 @@ namespace Volian.Svg.Library
|
||||
get { return _Watermark; }
|
||||
set { _Watermark = value; }
|
||||
}
|
||||
private string _WatermarkColor = "BLUE";
|
||||
public string WatermarkColor
|
||||
{
|
||||
get { return _WatermarkColor; }
|
||||
set { _WatermarkColor = value; }
|
||||
}
|
||||
private PdfLayer _PROMSVersionLayer; //C2018-009 print PROMS version
|
||||
public PdfLayer PROMSVersionLayer
|
||||
{
|
||||
@@ -1136,7 +1142,7 @@ namespace Volian.Svg.Library
|
||||
System.Drawing.Drawing2D.Matrix myMatrix = new System.Drawing.Drawing2D.Matrix((float)Math.Cos(a), (float)Math.Sin(a), (float)-Math.Sin(a), (float)Math.Cos(a), 0, cb.PdfDocument.PageSize.Height);
|
||||
cb.Transform(myMatrix);
|
||||
}
|
||||
SvgWatermark myWatermark = new SvgWatermark(cb, Watermark, System.Drawing.Color.Blue, .15F);
|
||||
SvgWatermark myWatermark = new SvgWatermark(cb, Watermark, System.Drawing.Color.FromName(WatermarkColor), .15F);
|
||||
//myWatermark.SetSquareDotPattern(.7F);
|
||||
myWatermark.Draw();
|
||||
if (_WatermarkLayer != null) cb.EndLayer();
|
||||
@@ -1211,7 +1217,7 @@ namespace Volian.Svg.Library
|
||||
{
|
||||
private PdfContentByte _ContentByte;
|
||||
private string _Text;
|
||||
private Color _Color;
|
||||
private System.Drawing.Color _Color;
|
||||
private PdfPatternPainter _PatternPainter;
|
||||
private BaseFont _Basefont;
|
||||
private float _Fontsize;
|
||||
@@ -1225,11 +1231,12 @@ namespace Volian.Svg.Library
|
||||
_Text = text;
|
||||
//float radius = .5F;
|
||||
//float space = 3;
|
||||
_Color = new Color(color);
|
||||
_Color = color; // C2021-019: save color for color override
|
||||
_Opacity = opacity;
|
||||
//SetDotPattern(radius, space);
|
||||
//SetTextLayout();
|
||||
}
|
||||
#region commentedout
|
||||
//private void SetTextLayout()
|
||||
//{
|
||||
// Rectangle pageSize = _ContentByte.PdfWriter.PageSize; // Get page size
|
||||
@@ -1316,6 +1323,7 @@ namespace Volian.Svg.Library
|
||||
// _PatternPainter.ShowTextAligned(PdfContentByte.ALIGN_LEFT, _Text, wid, hgtA, 0);
|
||||
// _PatternPainter.EndText();
|
||||
//}
|
||||
#endregion
|
||||
public void Draw()
|
||||
{
|
||||
_ContentByte.SaveState();
|
||||
@@ -1364,10 +1372,11 @@ namespace Volian.Svg.Library
|
||||
g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
gp.AddString(msg, fnt.FontFamily, 0, fntSize, new System.Drawing.PointF(-bnds.X, -bnds.Y),
|
||||
System.Drawing.StringFormat.GenericTypographic);
|
||||
System.Drawing.Drawing2D.HatchBrush aHatchBrush = new System.Drawing.Drawing2D.HatchBrush(System.Drawing.Drawing2D.HatchStyle.Percent25, System.Drawing.Color.FromArgb(64,
|
||||
System.Drawing.Color.Blue), System.Drawing.Color.Transparent);
|
||||
// C2021-019: allow setting of watermark color
|
||||
System.Drawing.Drawing2D.HatchBrush aHatchBrush = new System.Drawing.Drawing2D.HatchBrush(System.Drawing.Drawing2D.HatchStyle.Percent25,
|
||||
_Color, System.Drawing.Color.Transparent);
|
||||
g.FillPath(aHatchBrush, gp);
|
||||
g.DrawPath(new System.Drawing.Pen(System.Drawing.Color.FromArgb(96, System.Drawing.Color.Blue)), gp);
|
||||
g.DrawPath(new System.Drawing.Pen(_Color), gp);
|
||||
//g.DrawRectangle(System.Drawing.Pens.Cyan, 0, 0, bnds.Width, bnds.Height);
|
||||
}
|
||||
_WatermarkImage = iTextSharp.text.Image.GetInstance(bmp, System.Drawing.Imaging.ImageFormat.Png);
|
||||
|
Reference in New Issue
Block a user