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:
parent
9ec1177447
commit
544d408616
@ -540,6 +540,19 @@ namespace Volian.Print.Library
|
||||
//token = Regex.Replace(token, @"[\xB3-\xDF]", " ");
|
||||
switch (match.Value)
|
||||
{
|
||||
case "{!atom}":
|
||||
// Add an Atom Figure to the SVG
|
||||
AddImage(svgGroup,160.5f, 170.5f,288f, 323f,"atom.bmp");
|
||||
break;
|
||||
case "{!cpllogo}":
|
||||
AddImage(svgGroup, 10f, 10f, 78.7f, 29.8f, "cpllogo.bmp");
|
||||
break;
|
||||
case "{!domlogo}":
|
||||
AddImage(svgGroup, 10f, 70f, 123f, 40.1f, "domlogo.bmp");
|
||||
break;
|
||||
case "{!gpclogo}":
|
||||
AddImage(svgGroup, 10f, 150f, 35.2f, 35.8f, "gpclogo.bmp");
|
||||
break;
|
||||
case "{HEADER1}":
|
||||
case "{HEADER2}":
|
||||
case "{HEADER3}":
|
||||
@ -568,10 +581,19 @@ namespace Volian.Print.Library
|
||||
svgGroup.Add(PageItemToSvgUse(pageItem, FirstAndLast(box)));
|
||||
break;
|
||||
case "{DRAFTPAGE}":
|
||||
if (!AllowedWatermarks.Contains("Draft")) AllowedWatermarks.Add("Draft");
|
||||
break;
|
||||
case "{REFERENCEPAGE}":
|
||||
if (!AllowedWatermarks.Contains("Reference")) AllowedWatermarks.Add("Reference");
|
||||
break;
|
||||
case "{MASTERPAGE}":
|
||||
if (!AllowedWatermarks.Contains("Master")) AllowedWatermarks.Add("Master");
|
||||
break;
|
||||
case "{SAMPLEPAGE}":
|
||||
//mySvg.SetValidWaterMark(token, _Watermark); // Need logic to limit watermark to tokens.
|
||||
if (!AllowedWatermarks.Contains("Sample")) AllowedWatermarks.Add("Sample");
|
||||
break;
|
||||
case "{INFORMATIONPAGE}":
|
||||
if (!AllowedWatermarks.Contains("Information Only")) AllowedWatermarks.Add("Information Only");
|
||||
break;
|
||||
case "{PROCTITLE}":
|
||||
case "{PROCTITLE1}":
|
||||
@ -661,6 +683,12 @@ namespace Volian.Print.Library
|
||||
}
|
||||
mySvg.Add(svgGroup);
|
||||
}
|
||||
|
||||
private static void AddImage(SvgGroup svgGroup, float x, float y, float w, float h, string figure)
|
||||
{
|
||||
svgGroup.Add(new SvgImage(new System.Drawing.PointF(x, y), new System.Drawing.SizeF(w, h),
|
||||
System.Windows.Forms.Application.StartupPath + @"\Resources\" + figure));
|
||||
}
|
||||
private void SplitTitle(SvgGroup svgGroup, VEPROMS.CSLA.Library.PageItem pageItem, string title, int? len, string match)
|
||||
{
|
||||
if (match == "{PROCTITLE2}") return;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user