Esempio n. 1
0
        public static async Task ConvertHtmlTPdf(string theme, string html, string baseDirectory, string sourceFilePath, string targetFilePath, string title, DateTime?ignoreGitCommitsSince)
        {
            var settings = ThemeProvider.GetOptions(theme);

            var pdfOptions = new PdfOptions
            {
                FooterHtml   = ReplacePlaceholders(theme, ThemeProvider.GetFooter(theme), sourceFilePath, title, ignoreGitCommitsSince),
                HeaderHtml   = ReplacePlaceholders(theme, ThemeProvider.GetHeader(theme), sourceFilePath, title, ignoreGitCommitsSince),
                FooterHeight = settings.Pdf.FooterHeight,
                HeaderHeight = settings.Pdf.HeaderHeight
            };

            var pdfer = new AdliancePdfer(new AdliancePdferSettings());
            var pdf   = await pdfer.HtmlToPdf(html, pdfOptions);

            await File.WriteAllBytesAsync(targetFilePath, pdf);
        }