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 bool _UseInternalY = false; // B2020-121: Account for Header on Caution or Note public bool UseInternalY { get => _UseInternalY; set => _UseInternalY = value; } 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); if (UseInternalY) yLocation = YOffset; // B2020-121: Account for Header on Caution or Note // 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) { // C2018-004 create meta file for baseline compares Volian.Base.Library.BaselineMetaFile.WriteLine("MC X={0} Y={1} {2}", XOffset - MyPageHelper.MySvg.LeftMargin, yLocation + MyPageHelper.TableAdjustment, MacroDef); // PageList items are located with respect to the left margin, macros are not. // B2019-094 - needed to account for TableAdjustment - checkoff in South Texas FSG20 Addendum 5 step 5 MyPageHelper.MySvg.DrawMacro(MacroDef, XOffset - MyPageHelper.MySvg.LeftMargin, yLocation + MyPageHelper.TableAdjustment, cb); } PrintOverride.SvgColor = push; if (textLayer != null) cb.EndLayer(); cb.RestoreState(); return yPageStart; } } }