/// <summary> /// Renders the specified print context. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> public void Render(PrintContext printContext, object output, Epub.NavPoint parentEndPoint) { if (this.RenderingItem == null) this.RenderingItem = printContext.StartItem; this.BeginRender(printContext); this.RenderContent(printContext, output, parentEndPoint); }
void PrintHeader(Cairo.Context cr, PrintContext context, int page, ref double xPos, ref double yPos) { if (headerLines == 0) { return; } ResetAttributes(); layout.SetText(Subst(headerText, page)); int wout, hout; layout.GetSize(out wout, out hout); double w = wout / Pango.Scale.PangoScale; cr.MoveTo((pageWidth - w) / 2, yPos); Pango.CairoHelper.ShowLayout(cr, layout); yPos += lineHeight * headerLines; if (settings.HeaderSeparatorWeight > 0) { cr.LineWidth = settings.HeaderSeparatorWeight; cr.MoveTo(pageWidth / 3, yPos + (settings.HeaderPadding / 2)); cr.LineTo(2 * pageWidth / 3, yPos + (settings.HeaderPadding / 2)); cr.Stroke(); } yPos += settings.HeaderPadding; }
/// <summary> /// Parses the content. /// </summary> /// <param name="printContext">The print context.</param> /// <returns> /// The content. /// </returns> /// protected override string ParseContent(PrintContext printContext) { string content = base.ParseContent(printContext); IDictionary<string, string> variables = new Dictionary<string, string>(); int tocIndex = 2; if (printContext.Settings.Parameters.ContainsKey(this.IndexValue)) { tocIndex = (int)printContext.Settings.Parameters[this.IndexValue]; } Item dataItem = this.GetDataItem(printContext); string fieldContents = dataItem[ReplaceNameField]; variables.Add(this.ReplaceVar, tocIndex.ToString()); SetVariableName(ref content, IndexName, fieldContents); ReplaceVariables(ref content, variables); printContext.Settings.Parameters[this.IndexValue] = tocIndex + 1; return content; }
/// <summary> /// Begins the render. /// </summary> /// <param name="printContext">The print context.</param> /// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, XElement output) { XElement imageNode = RenderItemHelper.CreateXElement("Image", this.RenderingItem, printContext.Settings.IsClient, null); string imageFilePath = string.Empty; Item contentItem = this.GetDataItem(printContext); string ExternalID = contentItem[this.FieldName]; if (contentItem != null && !string.IsNullOrEmpty(this.baseUrl)) { try { string url = this.GenerateQrCodeUrl(this.baseUrl, this.path, ExternalID); imageFilePath = ImageRendering.CreateQrOnServer(printContext.Settings, this.RenderingItem, url); string qrcodeFilePath = this.GetQrImageFilePath(contentItem, printContext.Settings); File.Copy(imageFilePath, qrcodeFilePath, true); imageFilePath = qrcodeFilePath; } catch (Exception exc) { Log.Error(exc.Message, this); imageFilePath = string.Empty; } } imageFilePath = printContext.Settings.FormatResourceLink(imageFilePath); imageNode.SetAttributeValue("LowResSrc", imageFilePath); imageNode.SetAttributeValue("HighResSrc", imageFilePath); output.Add(imageNode); this.RenderChildren(printContext, imageNode); }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, object output, Epub.NavPoint parentEndPoint) { if (string.IsNullOrEmpty(this.Tag)) { this.RenderChildren(printContext, output, parentEndPoint); } else { if (output is HtmlDocument) { var elem = (HtmlDocument)output; HtmlNode element = RenderItemHelper.CreateHtmlNode(this.Tag, elem); element.InnerHtml = this.ParseContent(printContext); this.RenderStyling(element); elem.DocumentNode.SelectSingleNode("/html/body").AppendChild(element); this.RenderChildren(printContext, element, parentEndPoint); } else if (output is HtmlNode) { var elem = (HtmlNode)output; HtmlNode element = RenderItemHelper.CreateHtmlNode(this.Tag, elem); element.InnerHtml = this.ParseContent(printContext); this.RenderStyling(element); elem.AppendChild(element); this.RenderChildren(printContext, element, parentEndPoint); } } }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, XElement output) { if (this.RenderingItem["Skip"].Equals("1")) return; XElement parentNode = new XElement((XName)"ScriptResult"); if (ScriptHelper.ExecuteScriptReference(printContext, this.RenderingItem, this.GetDataItem(printContext), parentNode)) { int num = Enumerable.Count<XElement>(parentNode.Descendants((XName)"Page")); if (num > 0) printContext.PageCount += num; output.Add((object)parentNode.Elements()); } else { XElement page = this.CreatePage(printContext, false, false); if (page != null) { ++printContext.PageCount; this.RenderChildren(printContext, page); if (SkipIfEmpty && string.IsNullOrWhiteSpace(page.Value)) { --printContext.PageCount; return; } output.Add((object)page); } } }
protected override void RenderContent(PrintContext printContext, XElement output) { if (string.IsNullOrEmpty(this.Tag)) { this.RenderChildren(printContext, output); } else { XElement xelement = RenderItemHelper.CreateXElement(this.Tag, this.RenderingItem, printContext.Settings.IsClient, this.GetDataItem(printContext), true); if (!string.IsNullOrWhiteSpace(this.CustomAttribute)) { if (this.CustomAttribute == "DataSource") { if (!string.IsNullOrWhiteSpace(this.DataSource)) { xelement.SetAttributeValue((XName)"CustomAttribute", this.DataSource); } } else { xelement.SetAttributeValue((XName)"CustomAttribute", this.CustomAttribute); } } if (!string.IsNullOrEmpty(xelement.Value) || this.RenderingItem["Publish when empty"] == "1") { output.Add((object)xelement); } this.RenderChildren(printContext, xelement); } }
/// <summary> /// Creates the variable. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="skipNumber">if set to <c>true</c> [skip number].</param> /// <param name="emptyNumber">if set to <c>true</c> [empty number].</param> /// <returns></returns> protected virtual XElement CreateVariable(PrintContext printContext, bool skipNumber, bool emptyNumber) { Item renderingItem = this.RenderingItem; XElement xelement = RenderItemHelper.CreateXElement("Variable", renderingItem, printContext.Settings.IsClient, (Item)null, true); if (renderingItem.Fields["Find"] != null && renderingItem.Fields["Replace"] != null) { if (printContext.Settings.IsClient && renderingItem.Fields["PageXML"] != null) XElementExtensions.AddInnerXml(xelement, renderingItem.Fields["PageXML"].Value, false); var findElement = new XElement("Find", (object)renderingItem["Find"]); xelement.Add(findElement); if (printContext.Settings.Parameters.ContainsKey("Variables") && (SafeDictionary<string, object>)printContext.Settings.Parameters["Variables"] != null) { var variables = (SafeDictionary<string, object>)printContext.Settings.Parameters["Variables"]; var variable = variables.FirstOrDefault(v => v.Key == (string)renderingItem["Find"]); var replaceElement = new XElement("Replace", (object)variable.Value); xelement.Add(replaceElement); } else { var replaceElement = new XElement("Replace", (object)renderingItem["Replace"]); xelement.Add(replaceElement); } } return xelement; }
void ejecutar_consulta_reporte(PrintContext context) { Cairo.Context cr = context.CairoContext; Pango.Layout layout = context.CreatePangoLayout(); TreeIter iter; string toma_descrip_prod; string toma_descrip_alm; if (this.treeViewEngineFarmacia.GetIterFirst(out iter)) { imprime_encabezado(cr, layout); while (this.treeViewEngineFarmacia.IterNext(ref iter)) { toma_descrip_alm = (string)this.treeViewEngineFarmacia.GetValue(iter, 11); if (toma_descrip_alm.Length > 22) { toma_descrip_alm = toma_descrip_alm.Substring(0, 21); } toma_descrip_alm = (string)this.treeViewEngineFarmacia.GetValue(iter, 11); if (toma_descrip_alm.Length > 22) { toma_descrip_alm = toma_descrip_alm.Substring(0, 21); } } } }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, XElement output) { XElement xelement = RenderItemHelper.CreateXElement("Image", this.RenderingItem, printContext.Settings.IsClient, (Item)null); string absoluteFilePath = string.Empty; Item dataItem = this.GetDataItem(printContext); if (dataItem != null) { absoluteFilePath = ImageRendering.CreateQrOnServer(printContext.Settings, this.RenderingItem, LinkManager.GetItemUrl(dataItem, new UrlOptions() { AlwaysIncludeServerUrl = true, LowercaseUrls = true })); } if (string.IsNullOrEmpty(absoluteFilePath)) { xelement.SetAttributeValue((XName)"LowResSrc", (object)this.RenderingItem["LowResSrc"]); xelement.SetAttributeValue((XName)"HighResSrc", (object)this.RenderingItem["HighResSrc"]); } else { string str2 = printContext.Settings.FormatResourceLink(absoluteFilePath); xelement.SetAttributeValue((XName)"LowResSrc", (object)str2); xelement.SetAttributeValue((XName)"HighResSrc", (object)str2); } output.Add((object)xelement); this.RenderChildren(printContext, xelement); }
protected override void BeginRender(PrintContext printContext) { if (string.IsNullOrEmpty(base.DataSource)) { base.DataSource = base.RenderingItem["item reference"]; } }
protected override void OnBeginPrint(PrintContext context) { layout = PangoUtil.CreateLayout(context); layout.FontDescription = settings.Font; using (var PangoContext = context.CreatePangoContext()) using (var metrics = PangoContext.GetMetrics(settings.Font, PangoContext.Language)) { lineHeight = Math.Ceiling(0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale); } SetHeaderFormat(settings.HeaderFormat); SetFooterFormat(settings.FooterFormat); style = SyntaxHighlightingService.GetEditorTheme(settings.EditorTheme); pageWidth = context.PageSetup.GetPageWidth(Unit.Pixel); pageHeight = context.PageSetup.GetPageHeight(Unit.Pixel); double contentHeight = pageHeight - (headerLines > 0? settings.HeaderPadding : 0) - (footerLines > 0? settings.FooterPadding : 0); linesPerPage = (int)(contentHeight / lineHeight) - (headerLines + footerLines); totalPages = (int)Math.Ceiling((double)editor.LineCount / linesPerPage); NPages = totalPages; base.OnBeginPrint(context); }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, XElement output) { try { var tempElement = new XElement("temp"); base.RenderContent(printContext, tempElement); var textFrame = tempElement.Element("TextFrame"); if (textFrame != null) { var userFirstName = Context.User.Profile.FullName; if (string.IsNullOrEmpty(userFirstName)) { userFirstName = "Example User"; } // Set text variable to match user points value var textParagraph = textFrame.Element("ParagraphStyle"); if (textParagraph != null) { var textValue = textParagraph.Value; textParagraph.ReplaceNodes( new XCData(textValue.Replace("$name", userFirstName).ToString()) ); } output.Add(textFrame); } } catch (Exception exc) { Log.Error("Rendering the user message text", exc, this); } }
protected override void RenderContent(PrintContext printContext, XElement output) { var tempElement = new XElement("temp"); base.RenderContent(printContext, tempElement); var textFrame = tempElement.Element("TextFrame"); if (textFrame == null) { return; } var textParagraph = textFrame.Element("ParagraphStyle"); if (textParagraph != null) { var items = GetUserSelectionItems(printContext); if (items != null) { var textValue = textParagraph.Value; var fieldToReplace = GetFieldsToReplace(textValue); foreach (var field in fieldToReplace) { var userSelectionString = string.Join(Separator, items.Select(item => item[field])); textValue = textValue.Replace($"${field}", userSelectionString); } textParagraph.ReplaceNodes(new XCData(textValue)); } } output.Add(textFrame); }
private XElement GetRenderedParagraph(PrintContext printContext) { var temp = new XElement("temp"); base.RenderContent(printContext, temp); return(temp.Element(Tag)); }
protected override void OnBeginPrint(PrintContext context) { layout = PangoUtil.CreateLayout(context); layout.FontDescription = settings.Font; layout.FontDescription.Weight = Pango.Weight.Bold; layout.SetText(" "); int w, h; layout.GetSize(out w, out h); this.lineHeight = h / Pango.Scale.PangoScale; layout.FontDescription.Weight = Pango.Weight.Normal; SetHeaderFormat(settings.HeaderFormat); SetFooterFormat(settings.FooterFormat); style = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle(null, settings.ColorScheme); pageWidth = context.PageSetup.GetPageWidth(Unit.Pixel); pageHeight = context.PageSetup.GetPageHeight(Unit.Pixel); double contentHeight = pageHeight - (headerLines > 0? settings.HeaderPadding : 0) - (footerLines > 0? settings.FooterPadding : 0); linesPerPage = (int)(contentHeight / lineHeight) - (headerLines + footerLines); totalPages = (int)Math.Ceiling((double)doc.LineCount / linesPerPage); NPages = totalPages; base.OnBeginPrint(context); }
protected override void RenderContent(PrintContext printContext, XElement output) { if (string.IsNullOrEmpty(this.Tag)) { this.RenderChildren(printContext, output); } else { XElement xelement = RenderItemHelper.CreateXElement(this.Tag, this.RenderingItem, printContext.Settings.IsClient, this.GetDataItem(printContext), true); if (!string.IsNullOrEmpty(Position)) { xelement.SetAttributeValue("Position", this.Position); } if (!string.IsNullOrEmpty(this.RenderingItem["Center"])) { xelement.SetAttributeValue("Center", this.RenderingItem["Center"]); } else { xelement.SetAttributeValue("Center", "0"); } if (!string.IsNullOrEmpty(Alignment)) { xelement.SetAttributeValue("Alignment", this.Alignment); } output.Add((object)xelement); this.RenderChildren(printContext, xelement); } }
protected override void RenderContent(PrintContext printContext, XElement output) { XElement baseXml = new XElement("base"); base.RenderContent(printContext, baseXml); XElement textFrame = baseXml.Element("TextFrame"); Item dataItem = GetDataItem(printContext); XElement xElement = RenderItemHelper.CreateXElement("TextFrame", base.RenderingItem, printContext.Settings.IsClient, dataItem); this.SetAttributes(xElement); output.Add(xElement); XAttribute xAttribute = output.Attribute("ParagraphStyle"); string text = (xAttribute != null && !string.IsNullOrEmpty(xAttribute.Value)) ? xAttribute.Value : "NormalParagraphStyle"; Field fieldname = dataItem.Fields[this.ContentFieldName]; DateField dateField = fieldname; string dateoutput = dateField.DateTime.ToString(Format); IEnumerable<XElement> result = this.FormatText(text, dateoutput); xElement.Add(result); this.RenderChildren(printContext, xElement); }
public static string Print(Parser.Result parseResults) { PrintContext context = new PrintContext(); foreach (GlobalStatement global in parseResults.Globals) { global.AcceptVisitor(context, null); context.StringBuilder.AppendLine(); } context.StringBuilder.AppendLine(); foreach (SubroutineStatement function in parseResults.Functions) { context.StringBuilder.Append("function "); function.AcceptVisitor(context, null); context.StringBuilder.AppendLine(); context.StringBuilder.AppendLine(); } foreach (ClassStatement cls in parseResults.Classes) { cls.AcceptVisitor(context, null); context.StringBuilder.AppendLine(); context.StringBuilder.AppendLine(); } return(context.StringBuilder.ToString()); }
/// <summary> /// Parses the content. /// </summary> /// <param name="printContext">The print context.</param> /// <returns> /// The content. /// </returns> protected override string ParseContent(PrintContext printContext) { Assert.IsNotNullOrEmpty(this.ContentFieldName, "Missing content field"); if (!string.IsNullOrEmpty(AlternateTitleDataKey) && !string.IsNullOrEmpty(AlternateTitleField) && printContext.Settings.Parameters.ContainsKey(AlternateTitleDataKey)) { var dataItemId = (string)printContext.Settings.Parameters[AlternateTitleDataKey]; if (!string.IsNullOrEmpty(dataItemId) && this.ContentItem != null) { var dataItem = this.ContentItem.Database.GetItem(dataItemId); if (dataItem != null) { var fld = dataItem.Fields[HttpUtility.UrlDecode(AlternateTitleField)]; if (fld != null && !string.IsNullOrEmpty(fld.Value)) { NameValueCollection titles = Sitecore.Web.WebUtil.ParseUrlParameters(fld.Value); var personItemName = RemoveSpecialCharacter(this.ContentItem.Name); foreach (string key in titles) { var title = titles[key]; if (RemoveSpecialCharacter(key) == personItemName) { if (!string.IsNullOrEmpty(title)) { return title; } } } } } } } return base.ParseContent(printContext); }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, XElement output) { if (printContext.Settings.Parameters.ContainsKey(this.ListName)) { var tempElement = new XElement("temp"); base.RenderContent(printContext, tempElement); var textParagraph = tempElement.Element("ParagraphStyle"); if (textParagraph != null) { var indexList = (Dictionary<string, List<string>>)printContext.Settings.Parameters[this.ListName]; var destinations = from indexItem in indexList orderby indexItem.Key ascending select indexItem; foreach (KeyValuePair<string, List<string>> destination in destinations) { IDictionary<string, string> variables = new Dictionary<string, string>(); variables.Add("$Destination", destination.Key); var varList = new List<string>(); destination.Value.ForEach(s => this.FormatTocIndex(s, ref varList)); string formattedIndexes = string.Join("<![CDATA[, ]]>", varList.ToArray()); variables.Add("$Indexes", formattedIndexes); var textValue = textParagraph.ToString(SaveOptions.DisableFormatting); RenderingHelper.ReplaceVariables(ref textValue, variables); output.AddFragment(textValue); } } } }
protected override void RenderContent(PrintContext printContext, XElement output) { string ListPriceKey = "List"; XElement baseXml = new XElement("base"); base.RenderContent(printContext, baseXml); XElement textFrame = baseXml.Element("TextFrame"); Item dataItem = GetDataItem(printContext); XElement xElement = RenderItemHelper.CreateXElement("TextFrame", base.RenderingItem, printContext.Settings.IsClient, dataItem); this.SetAttributes(xElement); output.Add(xElement); XAttribute xAttribute = output.Attribute("ParagraphStyle"); string text = (xAttribute != null && !string.IsNullOrEmpty(xAttribute.Value)) ? xAttribute.Value : "H1 Orange"; Field fieldname = dataItem.Fields[this.ContentFieldName]; DateField dateField = fieldname; var request = new GetProductPricesRequest(dataItem["ExternalID"]); var response = new PricingServiceProvider(); var price = response.GetProductPrices(request).Prices[ListPriceKey].Amount; //var price = response.Prices.ContainsKey(ListPriceKey) ? response.Prices[ListPriceKey].Amount : decimal.Zero; //var price = this.pricingService.GetProductPrice("11"); IEnumerable<XElement> result = this.FormatText(text, price.ToString("c")); xElement.Add(result); this.RenderChildren(printContext, xElement); }
protected override void RenderChildren(PrintContext printContext, XElement parentContainer) { IEnumerable<Item> children = (IEnumerable<Item>)this.RenderingItem.Children; if (!string.IsNullOrEmpty(this.spreadId)) children = Enumerable.Where<Item>((IEnumerable<Item>)this.RenderingItem.Children, (Func<Item, bool>)(page => this.spreadId.Equals(page["Spread ID"], StringComparison.InvariantCultureIgnoreCase))); this.RenderChildren(printContext, parentContainer, children); }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, XElement output) { // Create a temp node to serve as a container var temp = new XElement("temp"); // Call the base to generate the element xml base.RenderContent(printContext, temp); // Select the generated paragraph style element var paragraph = temp.Element(this.Tag); if (paragraph != null) { // Get the data item assigned to the snippet var dataItem = this.GetDataItem(printContext); if (dataItem != null && !string.IsNullOrEmpty(this.RenderingItem["Item Field"])) { // Fetch the value for the field point in the ParagraphStyle element and add it as a CDATA var data = dataItem[this.RenderingItem["Item Field"]]; if (!string.IsNullOrEmpty(data) || this.RenderingItem["Publish when empty"] == "1") { paragraph.AddFirst(new XCData(data)); } } if ((!string.IsNullOrEmpty(paragraph.Value) && ContainsAlphanumericCharacters(paragraph.Value)) || this.RenderingItem["Publish when empty"] == "1") { paragraph = RemovedNestedParagraphStyles(paragraph); output.Add(paragraph); } } }
/// <summary> /// Parses the content. /// </summary> /// <param name="printContext">The print context.</param> /// <returns></returns> protected override string ParseContent(PrintContext printContext) { Assert.IsNotNull(this.ContentItem, "Content item is null"); if (string.IsNullOrEmpty(this.ContentFieldName)) { return string.Empty; } Field contentField = this.ContentItem.Fields[this.ContentFieldName]; if (contentField == null) { return string.Empty; } CustomField field = FieldTypeManager.GetField(contentField); if (field == null) { return TransformationManager.ReplaceInvalidCharacters(contentField.Value, printContext.Settings.TransformationItem); } if (field is DateField) { return ((DateField)field).DateTime.ToString("MMMM dd, yyyy"); } else if (field is HtmlField) { return TransformationManager.TransformHtml(field.Value, printContext.Settings.TransformationItem); } return TransformationManager.ReplaceInvalidCharacters(field.Value, printContext.Settings.TransformationItem); }
/// <summary> /// Processes the CSS styles. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="ePubDocument">The e pub html.</param> private void ProcessCssStyles(PrintContext printContext, Epub.Document ePubDocument) { //add style sheets - needs to be revisited. link tags are not being closed foreach (var styleId in ((MultilistField)this.RenderingItem.Fields["StyleSheets"]).TargetIDs) { var styleSheet = printContext.Database.GetItem(styleId); if (styleSheet != null) { if (!string.IsNullOrEmpty(styleSheet["Custom Css"])) { var filePath = String.Concat("css/", styleSheet.Name, ".css"); ePubDocument.AddStylesheetData(filePath, styleSheet["Custom Css"]); printContext.StyleSheets.Add(filePath, String.Concat("../", filePath)); } if (!string.IsNullOrEmpty(styleSheet["MediaLibrary Reference"])) { var cssMediaItem = (MediaItem)((FileField)styleSheet.Fields["MediaLibrary Reference"]).MediaItem; if (cssMediaItem != null) { var filePath = String.Concat("css/", cssMediaItem.Name, ".", cssMediaItem.Extension); ePubDocument.AddData(filePath, ReadFully(cssMediaItem.GetMediaStream()), "text/css"); printContext.StyleSheets.Add(filePath, String.Concat("../", filePath)); } } } } }
/// <summary> /// Parses the content. /// </summary> /// <param name="printContext">The print context.</param> /// <returns> /// The content. /// </returns> protected override string ParseContent(PrintContext printContext) { Assert.IsNotNullOrEmpty(this.ContentFieldName, "Missing content field"); Field contentField = this.ContentItem.Fields[this.ContentFieldName]; if (contentField == null) { return string.Empty; } CustomField field = FieldTypeManager.GetField(contentField); if (field == null || !string.IsNullOrWhiteSpace(field.Value)) { return AddWrapping(contentField.Value); } contentField = this.ContentItem.Fields[HttpUtility.UrlDecode(this.FallbackFieldName)]; if (contentField == null) { return string.Empty; } field = FieldTypeManager.GetField(contentField); if (field == null) { return AddWrapping(contentField.Value); } if(!string.IsNullOrWhiteSpace(this.ContentItem[HttpUtility.UrlDecode(this.FallbackFieldName)])) if (field is LookupField || field is ReferenceField) { Item innerItem = null; if (field is LookupField) { innerItem = ((LookupField)field).TargetItem; } else if (field is ReferenceField) { innerItem = ((ReferenceField)field).TargetItem; } if (innerItem != null) { if (!string.IsNullOrEmpty(this.ReferencedItemField) && innerItem.Fields[HttpUtility.UrlDecode(this.ReferencedItemField)] != null) { this.ContentItem = innerItem; this.ContentFieldName = HttpUtility.UrlDecode(this.ReferencedItemField); return AddWrapping(base.ParseContent(printContext)); } return AddWrapping(innerItem.DisplayName); } } else if (field is TextField) { return AddWrapping(field.Value); } return AddWrapping(base.ParseContent(printContext)); }
public PrintsController(IJsReportMVCService jsreport, IHostingEnvironment env, PrintContext context, BookingFormContext booking, UserManager <Sale> userManager) { _jsReportMVCService = jsreport; _env = env; _booking = booking; _userManager = userManager; _context = context; }
protected override void RenderContent(PrintContext printContext, XElement output) { if (output.Element((XName)"Variables") != null) return; XElement parentContainer = new XElement((XName)"Variables"); output.Add((object)parentContainer); this.RenderChildren(printContext, parentContainer); }
private void PrintIdentifierAndSize(PrintContext context) { context.Printer.Print(OutputType.Other, " "); context.Printer.Print(OutputType.Identifier, name); context.Printer.Print(OutputType.Other, " "); context.Printer.PrintLn(OutputType.Comment, String.Format("// size = {0} bytes", size)); }
/// <summary> /// Gets the data item. /// </summary> /// <param name="printContext">The print context.</param> /// <returns></returns> protected virtual Item GetDataItem(PrintContext printContext) { Item obj = (Item)null; string dataSource = this.DataSource; if (dataSource.Length > 0) obj = !MainUtil.IsFullPath(dataSource) ? this.RenderingItem.Axes.GetItem(dataSource) : printContext.Database.GetItem(dataSource); return obj; }
protected override void RenderContent(PrintContext printContext, object output, Epub.NavPoint parentEndPoint) { if (output == null) { return; } this.RenderChildren(printContext, output, parentEndPoint); }
void ejecutar_consulta_reporte(PrintContext context) { Cairo.Context cr = context.CairoContext; Pango.Layout layout = context.CreatePangoLayout(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); // cr.Rotate(90) Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; layout = null; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; }
public static XElement CreateDocumentElement(PrintContext printContext, Sitecore.Data.Items.Item renderingItem) { int languageIndex = LanguageManager.GetLanguages(printContext.Database).IndexOf(printContext.Language); XmlNode documentElement = Sitecore.PrintStudio.PublishingEngine.Rendering.DocumentRendering.CreateDocumentElement(new XmlDocument(), renderingItem, printContext.Database, languageIndex, printContext.StartItem, printContext.Settings.FormatResourceLink(printContext.Settings.CacheFolder), printContext.Settings.CacheFolder, JCore.SitecoreAPS.PrintStudio.Configuration.PrintStudioEngineSettings.EngineTemplates, printContext.Settings.IsClient ? "1" : "0", printContext.Settings.OverrideCache); if (documentElement != null) return XElementExtensions.GetXElement(documentElement); else return (XElement)null; }
/// <summary> /// Renders the page. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> /// <param name="skipNumber">if set to <c>true</c> [skip number].</param> /// <param name="emptyNumber">if set to <c>true</c> [empty number].</param> private void RenderPage(PrintContext printContext, XElement output, bool skipNumber = false, bool emptyNumber = false) { XElement pageContent = this.CreatePage(printContext, skipNumber, emptyNumber); printContext.PageCount++; this.RenderChildren(printContext, pageContent); output.Add(pageContent); }
protected override void RenderContent(PrintContext printContext, XElement output) { XElement parentNode = new XElement((XName)"Variables"); XElement page = this.CreateVariable(printContext, false, false); ++printContext.PageCount; this.RenderChildren(printContext, page); output.Add((object)page); }
/// <summary> /// Add the default message handlers. /// </summary> public void AddDefaultMessageHandlers() { PrintContext printContext = new PrintContext(); AddToBack(new NActionHandler(printContext)); AddToBack(new NCreateHandler(printContext)); AddToBack(new NDeleteHandler(printContext)); AddToBack(new NGetHandler(printContext)); AddToBack(new NSetHandler(printContext)); }
/// <summary> /// Populates the output. /// </summary> /// <param name="output">The output.</param> /// <param name="xhtmlDocument">The XHTML html.</param> private void PopulateOutput(PrintContext printContext, Epub.Document ePubDocument, HtmlDocument xhtmlDocument) { var ePubChapterFile = "cover"; var result = ePubDocument.AddXhtmlData(this.RenderingItem["ePub Base Path"] + ePubChapterFile + ".html", xhtmlDocument.DocumentNode.OuterHtml, false); ePubDocument.AddMetaItem("cover", "cover.html"); if (printContext.Images.Any()) { ePubDocument.AddMetaItem("cover-image", printContext.Images.FirstOrDefault().Key); } }
protected virtual IEnumerable <XElement> GetContent(PrintContext printContext, XElement textFrameNode) { XAttribute xattribute = textFrameNode.Attribute((XName)"ParagraphStyle"); string str = xattribute == null || string.IsNullOrEmpty(xattribute.Value) ? "NormalParagraphStyle" : xattribute.Value; if (!string.IsNullOrEmpty(this.InDesignContent)) { return(this.FormatText(str, this.InDesignContent)); } if (string.IsNullOrEmpty(this.ContentFieldName)) { return((IEnumerable <XElement>)null); } try { Item dataItem = this.GetDataItem(printContext); if (dataItem != null) { Field field = dataItem.Fields[this.ContentFieldName]; if (field == null) { return((IEnumerable <XElement>)null); } switch (field.Type) { case "Rich Text": ParseContext context = new ParseContext(printContext.Database, printContext.Settings) { DefaultParagraphStyle = str, ParseDefinitions = RichTextParser.GetParseDefinitionCollection(this.RenderingItem) }; string htmlWithItemId = $"<!--{dataItem.ID.Guid.ToString("B")}-->" + field.Value; string xml = RichTextParser.ConvertToXml(htmlWithItemId, context, printContext.Language); XElement element = new XElement((XName)"temp"); element.AddFragment(xml); return(element.Elements()); case "Single-Line Text": str = fieldStyles.ContainsKey(ContentFieldName) ? fieldStyles[ContentFieldName] : str; string singleLineContent = SitecoreHelper.FetchFieldValue(dataItem, field.Name, printContext.Database, str); return(this.FormatText(str, singleLineContent)); default: string content = SitecoreHelper.FetchFieldValue(dataItem, field.Name, printContext.Database, str); return(this.FormatText(str, content)); } } } catch (Exception ex) { Logger.Error("Rendering TextFrame: " + (object)this.RenderingItem.ID, ex); } return((IEnumerable <XElement>)null); }
/// <summary> /// The render content. /// </summary> /// <param name="printContext"> /// The print context. /// </param> /// <param name="output"> /// The output. /// </param> protected override void RenderContent(PrintContext printContext, XElement output) { XElement baseXml = new XElement("base"); base.RenderContent(printContext, baseXml); XElement textFrame = baseXml.Element("TextFrame"); if (textFrame != null) { output.Add(textFrame.Elements()); } }
void imprime_subtitulo(PrintContext ContextoImp, PrintJob trabajoImpresion, string grupodelproducto) { float varpaso = float.Parse(honorario_med); Print.Setfont(ContextoImp, fuente7); ContextoImp.MoveTo(29.5, filas); ContextoImp.Show(grupodelproducto); //625 ContextoImp.MoveTo(437.6, filas); ContextoImp.Show("TOTAL " + varpaso.ToString("C")); //625 filas -= 10; Print.Setfont(ContextoImp, fuente7); }
public static string Print(params Expression[] expressions) { PrintContext context = new PrintContext(); foreach (Expression expression in expressions) { expression.AcceptVisitor(context, null); } return(context.StringBuilder.ToString()); }
public static string Print(params Statements.Statement[] statements) { PrintContext context = new PrintContext(); foreach (Statement statement in statements) { statement.AcceptVisitor(context, null); } return(context.StringBuilder.ToString()); }
protected override void RenderContent(PrintContext printContext, XElement output) { XElement parentContainer = printContext.DocumentContainer; if (parentContainer == null) { parentContainer = new XElement((XName)"Documents"); output.Add((object)parentContainer); printContext.DocumentContainer = parentContainer; } this.RenderChildren(printContext, parentContainer); }
protected override void BeginRender(PrintContext printContext) { if (printContext.StartItem.TemplateName.Equals("P_Variable", StringComparison.InvariantCultureIgnoreCase) && printContext.StartItem.Fields["Spread ID"] != null && !string.IsNullOrEmpty(printContext.StartItem.Fields["Spread ID"].Value)) this.spreadId = printContext.StartItem.Fields["Spread ID"].Value; if (string.IsNullOrEmpty(this.spreadId)) return; int count = printContext.CurrentItemAncestors.IndexOf(this.RenderingItem.ID); if (count <= 0) return; printContext.CurrentItemAncestors.RemoveRange(0, count); }
void ejecutar_consulta_reporte(PrintContext context) { string descripcion_producto_aplicado; int idgrupoproducto; Cairo.Context cr = context.CairoContext; Pango.Layout layout = context.CreatePangoLayout(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); fontSize = 7.0; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; imprime_encabezado(cr, layout); }
/// <summary> /// Renders the content. /// </summary> /// <param name="printContext">The print context.</param> /// <param name="output">The output.</param> protected override void RenderContent(PrintContext printContext, object output, Epub.NavPoint parentEndPoint) { var xhtmlDocument = this.GenerateHtmlDocument(printContext); this.RenderChildren(printContext, xhtmlDocument, parentEndPoint); if (DoesChapterHaveContent(xhtmlDocument)) { var ePubDocument = (Epub.Document)output; this.ProcessImages(ePubDocument, xhtmlDocument, printContext); this.ProcessStyleSheets(xhtmlDocument, printContext); this.PopulateOutput(printContext, ePubDocument, xhtmlDocument); } }
void crea_consentimiento(PrintContext context) { Cairo.Context cr = context.CairoContext; Pango.Layout layout = context.CreatePangoLayout(); Pango.FontDescription desc = Pango.FontDescription.FromString("Sans"); // cr.Rotate(90) Imprimir Orizontalmente rota la hoja cambian las posiciones de las lineas y columna fontSize = 8.0; layout = null; layout = context.CreatePangoLayout(); desc.Size = (int)(fontSize * pangoScale); layout.FontDescription = desc; crea_encbezado(cr, layout); formato_consentimiento2(cr, layout); }
protected override void BeginRender(PrintContext printContext) { if (string.IsNullOrEmpty(this.DataSource)) { this.DataSource = this.RenderingItem["item reference"]; } if (!string.IsNullOrEmpty(this.ContentFieldName)) { return; } this.ContentFieldName = this.RenderingItem["item field"]; }
protected UIElement GetItemsPart() { IEnumerable <IDeliveryNoteItem> dataSource = PrintContext.GetPageItems(CurrentPage); DataGrid grid = new DataGrid() { AutoGenerateColumns = false, Margin = new Thickness(5, 0, 0, 0), SelectionUnit = DataGridSelectionUnit.CellOrRowHeader, SelectionMode = DataGridSelectionMode.Single, CanUserResizeColumns = false, CanUserSortColumns = false, CanUserAddRows = false, CanUserDeleteRows = false, CanUserReorderColumns = false, EnableRowVirtualization = false, ItemsSource = dataSource, IsReadOnly = true, HeadersVisibility = DataGridHeadersVisibility.None, BorderBrush = Brushes.White, Background = Brushes.White, GridLinesVisibility = DataGridGridLinesVisibility.Vertical }; DataGridTextColumn column = new DataGridTextColumn(); column.Width = 100; column.Binding = new Binding("SpecialCode"); grid.Columns.Add(column); column = new DataGridTextColumn(); column.Width = 100; column.Binding = new Binding("CentralCode"); grid.Columns.Add(column); column = new DataGridTextColumn(); column.Width = 400; column.Binding = new Binding("Name"); grid.Columns.Add(column); column = new DataGridTextColumn(); column.Width = 80; column.Binding = new Binding("Amount"); Style cellStyle = new Style(typeof(TextBlock)); cellStyle.Setters.Add(new Setter(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Right)); column.ElementStyle = cellStyle; grid.Columns.Add(column); return(grid); }
protected override void BeginRender(PrintContext printContext) { if (!string.IsNullOrEmpty(RenderingItem["Item Reference"])) { DataSource = RenderingItem["Item Reference"]; } if (!string.IsNullOrEmpty(RenderingItem["Data Key"]) && printContext.Settings.Parameters.ContainsKey(RenderingItem["Data Key"])) { var data = printContext.Settings.Parameters[RenderingItem["Data Key"]].ToString(); if (!string.IsNullOrEmpty(data)) { var items = StringUtil.Split(data, '|', true); if (items.Count() > 1) { DataSources = data; return; } var contextItem = printContext.Database.GetItem(data); if (contextItem != null) { DataSource = contextItem.ID.ToString(); } } } // Get the data item assigned to the repeater var dataItem = GetDataItem(printContext); if (dataItem != null) { // apply the selector to the data item if (!string.IsNullOrEmpty(RenderingItem["Item Selector"])) { var xpath = RenderingItem["Item Selector"]; if (!string.IsNullOrEmpty(xpath)) { var items = dataItem.Axes.SelectItems(xpath); if (items != null) { DataSources = string.Join("|", items.Select(t => t.ID.ToString()).ToArray()); } } } else if (!string.IsNullOrEmpty(RenderingItem["Item Field"])) { // Get the number of times we need to repeat the child elements Count = dataItem[RenderingItem["Item Field"]]; } } }
public rpt_honorario_med(int PidPaciente_, int folioservicio_, string _nombrebd_, string entry_fecha_admision_, string entry_hora_registro_, string entry_fechahora_alta_, string entry_nombre_paciente_, string entry_telefono_paciente_, string entry_doctor_, string entry_tipo_paciente_, string entry_aseguradora_, string edadpac_, string fecha_nacimiento_, string dir_pac_, string cirugia_, string empresapac_, int idtipopaciente_, string honorario_med_, string numfactu_) { PidPaciente = PidPaciente_; // folioservicio = folioservicio_; // nombrebd = _nombrebd_; // fecha_admision = entry_fecha_admision_; // hora_registro = entry_hora_registro_; // fechahora_alta = entry_fechahora_alta_; // nombre_paciente = entry_nombre_paciente_; // telefono_paciente = entry_telefono_paciente_; // doctor = entry_doctor_; // cirugia = cirugia_; // tipo_paciente = entry_tipo_paciente_; // id_tipopaciente = idtipopaciente_; aseguradora = entry_aseguradora_; // edadpac = edadpac_; // fecha_nacimiento = fecha_nacimiento_; // dir_pac = dir_pac_; // empresapac = empresapac_; // honorario_med = honorario_med_; numfactu = numfactu_; PrintJob trabajo = new PrintJob(PrintConfig.Default()); PrintDialog dialogo = new PrintDialog(trabajo, "RESUMEN DE FACTURA", 0); int respuesta = dialogo.Run(); if (respuesta == (int)PrintButtons.Cancel) { dialogo.Hide(); dialogo.Dispose(); return; } PrintContext ctx = trabajo.Context; ComponerPagina(ctx, trabajo); trabajo.Close(); switch (respuesta) { case (int)PrintButtons.Print: trabajo.Print(); break; case (int)PrintButtons.Preview: new PrintJobPreview(trabajo, "RESUMEN DE FACTURA").Show(); break; } dialogo.Hide(); dialogo.Dispose(); }
protected override bool OnPreview(PrintOperationPreview preview, PrintContext context, Window parent) { previewSurface = new ImageSurface(Format.ARGB32, previewPageWidth, previewPageHeight); context.SetCairoContext(new Context(previewSurface), previewDpiX, previewDpiY); ErrorHandling.LogError(string.Format("Starting preview with page size: {0}x{1}, Dpi: {2}x{3}, Orientation: {4}", previewPageWidth, previewPageHeight, previewDpiX, previewDpiY, context.PageSetup.Orientation), ErrorSeverity.Information); return(true); }
protected override void RenderContent(PrintContext printContext, XElement output) { Item dataItem = this.GetDataItem(printContext); XElement xElement = RenderItemHelper.CreateXElement("ImageFrame", base.RenderingItem, printContext.Settings.IsClient, dataItem); xElement.SetAttributeValue("SitecoreFieldname", base.RenderingItem["item field"]); xElement.SetAttributeValue("SitecoreMediaID", base.RenderingItem["medialibrary reference"]); xElement.SetAttributeValue("ItemReferenceID", base.RenderingItem["item reference"]); xElement.SetAttributeValue("RenderingID", base.RenderingItem["xml renderer"]); xElement.SetAttributeValue("ItemReferenceDisplayName", (dataItem != null) ? dataItem.DisplayName : string.Empty); output.Add(xElement); this.RenderChildren(printContext, xElement); }
protected override void RenderContent(PrintContext printContext, XElement output) { var paragraph = GetRenderedParagraph(printContext); if (paragraph == null) { return; } paragraph.Add(GetItemParagraphs(printContext)); output.Add(paragraph); }
protected virtual void OnPrintActionActivated(object sender, System.EventArgs e) { using (PrintContext context = new PrintContext(GdkWindow.Handle)) { printing = new PrintOperation(); printing.Unit = Unit.Points; printing.UseFullPage = false; printing.BeginPrint += HandlePrintBeginPrint; printing.DrawPage += HandlePrintDrawPage; printing.EndPrint += HandlePrintEndPrint; printing.Run(PrintOperationAction.PrintDialog, null); } }
// when invoking explicitly implemented interfaces, chop off the prefix of that interface static bool ExplicitInterfaceImpl(PrintContext context, out string method, out string explicitInterface) { var m = context.Info.Method; var dotIndex = m.Name.LastIndexOf(".", StringComparison.InvariantCulture); method = dotIndex == -1 ? m.Name : m.Name.Substring(dotIndex + 1, m.Name.Length - dotIndex - 1); explicitInterface = dotIndex == -1 ? "" : m.Name.Substring(0, dotIndex); return(dotIndex != -1); }
private Item[] GetUserSelectionItems(PrintContext printContext) { var value = this.RenderingItem.Parent.Fields[Templates.P_Snippet.Fields.DataKey].Value; if (value != null) { var parameter = printContext.Settings.Parameters[value]; if (parameter != null) { var items = GetSelectedItems(parameter.ToString(), printContext.Database); return(items); } } return(null); }
void imprime_titulo(PrintContext ContextoImp, PrintJob trabajoImpresion, string descrp_admin) { Print.Setfont(ContextoImp, fuente7); ContextoImp.MoveTo(20, filas + 8); ContextoImp.Show("________________________________________________________________________________________________________________________________________________"); Print.Setfont(ContextoImp, fuente9); //LUGAR DE CARGO ContextoImp.MoveTo(200.5, filas); ContextoImp.Show(descrp_admin.ToString().ToUpper()); //+" "+fech.ToString());//635 ContextoImp.MoveTo(201, filas); ContextoImp.Show(descrp_admin.ToString().ToUpper()); //+" "+fech.ToString());//635 Print.Setfont(ContextoImp, fuente7); ContextoImp.MoveTo(20, filas - 2); //633 ContextoImp.Show("________________________________________________________________________________________________________________________________________________"); //genera_lineac(ContextoImp, trabajoImpresion); filas -= 10; Print.Setfont(ContextoImp, fuente7); }