Beispiel #1
0
        /// <summary>
        /// Shortcut to generate PDF documents
        /// </summary>
        /// <param name="pathToPdfBodyTemplate">The path to PDF body template.</param>
        /// <param name="pathToPdfFooterTemplate">The path to PDF footer template.</param>
        /// <param name="objectToPassInToTemplate">The object to pass in to template.</param>
        /// <param name="keyValuePairTemplateVariables">The key value pair template variables.</param>
        /// <param name="downloadFileName">Name of the download file.</param>
        public static void QuickPDFGenerator(string pathToPdfBodyTemplate, string downloadFileName, string pathToPdfFooterTemplate = "", object objectToPassInToTemplate = null, Dictionary <string, string> keyValuePairTemplateVariables = default(Dictionary <string, string>))
        {
            string bodyHtml = ParserHelper.ParseData(LoaderHelper.RenderControl(pathToPdfBodyTemplate, objectToPassInToTemplate), keyValuePairTemplateVariables);

            string footerHtml = "";

            if (pathToPdfFooterTemplate == null)
            {
                footerHtml = ParserHelper.ParseData(LoaderHelper.RenderControl(pathToPdfFooterTemplate, objectToPassInToTemplate), keyValuePairTemplateVariables);
            }

            PDFHelper pdfHelper = new PDFHelper("Header Text");

            if (footerHtml != "")
            {
                pdfHelper.Converter.PdfFooterOptions.ShowPageNumber = false;
                pdfHelper.Converter.PdfFooterOptions.HtmlToPdfArea  = new HtmlToPdfArea(footerHtml, URIHelper.BaseUrl);
            }

            pdfHelper.ConvertHTMLToPDF(bodyHtml, StringHelper.CreateSlug(downloadFileName));
        }
Beispiel #2
0
        public static Return SendTemplate(IEnumerable <MailAddress> emailAddresses, string subject, string senderName, string senderEmailAddress, string pathToControl, params object[] constructorParameters)
        {
            string message = LoaderHelper.RenderControl(pathToControl, constructorParameters);

            return(Send(senderEmailAddress, emailAddresses, subject, message));
        }