示例#1
0
 /// <summary>
 /// Creates the html template and fills in the given data
 /// </summary>
 /// <param name="responseData">data object from HelloCash</param>
 /// <param name="targetPath">Path where to store the resulting pdf</param>
 /// <param name="pdfCustomization">PDFCustomization object to customize pdf generation</param>
 public PdfReceiptGenerator(InvoiceData responseData, FileInfo targetPath, PdfCustomization pdfCustomization = null)
 {
     this.ResponseData = responseData;
     this.HtmlTemplate = HTMLTemplateManager.GetHtmlTemplate(HtmlTemplateType.Receipt);
     this.TargetPath   = targetPath;
     this.FillTemplate(pdfCustomization);
 }
示例#2
0
        private void FillTemplate(PdfCustomization pdfCustomization)
        {
            var templateTextReplacer = new TemplateTextReplacer(HtmlTemplate, pdfCustomization);

            HtmlDocument = templateTextReplacer.ReplaceAll(ResponseData);

            if (pdfCustomization != null)
            {
                if (pdfCustomization.CustomValues != null)
                {
                    HtmlDocument = templateTextReplacer.ReplaceCustomValues(pdfCustomization.CustomValues);
                }
            }
        }
示例#3
0
 public TemplateTextReplacer(string htmlTemplate, PdfCustomization pdfCustomization = null)
 {
     HtmlTemplate     = htmlTemplate;
     PdfCustomization = pdfCustomization;
 }