John f7cb594d76 added check for null MacroDef
additional checks for checkoffs and logic support or NSP script Cautions with bullets
fixed pagelist processing issue when pagelist row has more than one token
support for NSP script Cautions
fixed problem where the END message was not printing for NSP (the Y location was negative – off the page)
2011-12-07 14:04:53 +00:00

48 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using iTextSharp.text.pdf;
using iTextSharp.text;
using VEPROMS.CSLA.Library;
namespace Volian.Print.Library
{
public partial class vlnMacro : vlnPrintObject
{
private string _MacroDef;
public string MacroDef
{
get { return _MacroDef; }
set { _MacroDef = value; }
}
public vlnMacro(float xoffset, float yoffset, string macroDef)
{
YOffset = yoffset;
XOffset = xoffset;
MacroDef = macroDef;
}
public override float ToPdf(PdfContentByte cb, float yPageStart, float yTopMargin, float yBottomMargin)
{
MyContentByte = cb;
float yLocation = CalculateYOffset(yPageStart, yTopMargin);
// Adjust the starting point for the Macro if the LPI is 7
if (MyPageHelper.YMultiplier != 1) yLocation += SixLinesPerInch - _SevenLinesPerInch;
VlnSvgPageHelper _MyPageHelper = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
PdfLayer textLayer = _MyPageHelper == null ? null : _MyPageHelper.TextLayer;
if (textLayer != null) cb.BeginLayer(textLayer);
MyContentByte = cb;
System.Drawing.Color push = PrintOverride.SvgColor;
PrintOverride.SvgColor = PrintOverride.TextColor == System.Drawing.Color.Empty ? System.Drawing.Color.Black : PrintOverride.TextColor;
if (MyPageHelper != null && MyPageHelper.MySvg != null && MacroDef != null)
{
// PageList items are located with respect to the left margin, macros are not.
MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset - MyPageHelper.MySvg.LeftMargin, yLocation, cb);
}
PrintOverride.SvgColor = push;
if (textLayer != null) cb.EndLayer();
return yPageStart;
}
}
}