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, ref float yTopMargin, ref float yBottomMargin) { cb.SaveState(); 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(); cb.RestoreState(); return yPageStart; } } }