Added handler for !atom pagelist token

Added code to deal with draftpage, samplepage, masterpage and referencepage tokens
Added code to limit allowed watermarks
This commit is contained in:
2011-09-28 17:53:13 +00:00
parent 9ec1177447
commit 544d408616
2 changed files with 40 additions and 1 deletions

View File

@@ -430,6 +430,10 @@ namespace Volian.Svg.Library
if (Width.Value != 0)
img.ScaleAbsoluteWidth(scale.M(Width));
img.SetAbsolutePosition(scale.X(X), scale.Y(cb, Y) - scale.M(img.ScaledHeight));
// The next three lines set the image opacity for testing
//PdfGState gState = new PdfGState();
//gState.FillOpacity = .2f;
//cb.SetGState(gState);
cb.AddImage(img);
cb.RestoreState();
}
@@ -790,6 +794,12 @@ namespace Volian.Svg.Library
}
public class SvgPageHelper : PdfPageEventHelper
{
private List<string> _AllowedWatermarks = new List<string>();
public List<string> AllowedWatermarks
{
get { return _AllowedWatermarks; }
set { _AllowedWatermarks = value; }
}
private Svg _MySvg;
public Svg MySvg
{
@@ -947,6 +957,7 @@ namespace Volian.Svg.Library
private void DrawWatermark(PdfContentByte cb)
{
if (Watermark.ToLower().Contains("none") || Watermark == "") return;
if (!AllowedWatermarks.Contains(Watermark)) return;
cb.SaveState();
if (_WatermarkLayer != null) cb.BeginLayer(_WatermarkLayer);
SvgWatermark myWatermark = new SvgWatermark(cb, Watermark, System.Drawing.Color.Blue, .15F);