Link Search Menu Expand Document

Convert DOCX to PDF - C#

PDF SDK sample in C# demonstrating ‘Convert DOCX to PDF’

Program.cs
using System.Diagnostics;
using System.Drawing.Printing;
using Bytescout.PDF.Converters;

namespace ConvertDocxToPdf
{
    class Program
    {
        static void Main(string[] args)
        {
            using (DocxToPdfConverter converter = new DocxToPdfConverter())
            {
                converter.PageSize = PaperKind.A4;
                converter.Orientation = PaperOrientation.Portrait;
                converter.Footer = "<p style=\"color: blue;\">FOOTER TEXT</p>";
                
                converter.ConvertDocxToPdf("sample.docx", "result.pdf");
            }

            // Open result document in default associated application (for demo purpose)
            ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf");
            processStartInfo.UseShellExecute = true;
            Process.Start(processStartInfo);
        }
    }
}

Download Source Code (.zip)

Return to the previous page Explore PDF SDK


Copyright © 2016 - 2021 ByteScout