예제 #1
0
        public static string PrintChildren(
            string AChildName,
            string ADonorName,
            bool AChildWithoutDonor,
            string APartnerStatus,
            string ASponsorshipStatus,
            string ASponsorAdmin,
            string ASortBy,
            string AReportLanguage)
        {
            SponsorshipFindTDSSearchResultTable table = FindChildren(AChildName, ADonorName, AChildWithoutDonor, APartnerStatus, ASponsorshipStatus, ASponsorAdmin, ASortBy);

            HtmlDocument HTMLDocument = HTMLTemplateProcessor.Table2Html(table, "Sponsorship/SponsoredChildrenList.html", AReportLanguage);

            string PDFFile = TFileHelper.GetTempFileName(
                "printchildrenlist",
                ".pdf");

            if (Html2Pdf.HTMLToPDF(HTMLDocument.DocumentNode.WriteTo(), PDFFile))
            {
                byte[] data   = System.IO.File.ReadAllBytes(PDFFile);
                string result = Convert.ToBase64String(data);
                System.IO.File.Delete(PDFFile);
                return(result);
            }

            return(String.Empty);
        }
예제 #2
0
        private static bool PrintToPDF(string AFilename, HtmlDocument AHTMLDocument)
        {
            // transform the HTML output to pdf file
            Html2Pdf.HTMLToPDF(AHTMLDocument.DocumentNode.WriteTo(), AFilename);

            return(true);
        }