2010-06-08 11:57:22 +00:00

45 lines
1.5 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)
MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset, yLocation, cb);
PrintOverride.SvgColor = push;
if (textLayer != null) cb.EndLayer();
return yPageStart;
}
}
}