using System.Net; using OfficeIMO.Drawing; using OfficeIMO.Html; using OfficeIMO.Html.Pdf; namespace OfficeIMO.Examples.Showcase.Workflows; /// Generates a personalized HTML completion certificate and a PDF review copy. internal static class CourseCertificate { internal static void Create(string folder) { string learner = "Maya Ellis"; string course = "Practical document automation"; string html = $$""" Course completion

NORTHWIND LEARNING

Certificate of completion

This recognizes that

{{WebUtility.HtmlEncode(learner)}}

completed the workshop

{{WebUtility.HtmlEncode(course)}}

Six hours of guided practice
Document generation, validation and review

1 September 2026
Learning facilitator: Jordan Lee

Sample certificate NW-2026-0142
Illustrative learning record; not a professional accreditation.

"""; File.WriteAllText(Path.Combine(folder, "example.html"), html); HtmlConversionDocument.Parse(html).SaveAsPdf(Path.Combine(folder, "preview.pdf"), new HtmlToPdfOptions { PageSize = OfficePageSizes.A4, Margins = HtmlRenderMargins.All(24D) }).RequireSuccess(); } }