private void docSign_PrintPage(object sender, PrintPageEventArgs e) { try { string dataFolder = _PlantFolder; string templateFile = Path.GetFileName(_TemplatePath); string templateFolder = Path.GetDirectoryName(_TemplatePath); MacroDefinitions macroDefs = new MacroDefinitions(); SingleSign.LoadMacroDefinitions(templateFile, templateFolder, macroDefs); MacroValues macros = new MacroValues(); SingleSign.AddStandardMacroValues(macros); foreach (MacroDefinition macroDef in macroDefs) { macros[macroDef.Name] = macroDef.Value; } XmlDocument dataDoc = SingleSign.CreateEmptySignDataDoc(); dataDoc.LoadXml(txtPlantFileContents.Text); SingleSign.AddDataFileMacros(macros, dataFolder, dataDoc); SingleSign singleSign = new SingleSign(); singleSign.Print(templateFile, templateFolder, macros, dataFolder, e); e.HasMorePages = false; } catch (Exception ex) { SingleSign.ShowException(ex); } }
private void LoadMacroDefs() { string templateFolder = Path.GetDirectoryName(_TemplatePath); string templateFile = Path.GetFileName(_TemplatePath); MacroDefinitions macroDefs = new MacroDefinitions(); SingleSign.LoadMacroDefinitions(templateFile, templateFolder, macroDefs); DisplayMacroDef(macroDefs, 0, txtMacro1Name, txtMacro1Value); DisplayMacroDef(macroDefs, 1, txtMacro2Name, txtMacro2Value); DisplayMacroDef(macroDefs, 2, txtMacro3Name, txtMacro3Value); }