//Opens the template document
WordDocument document = new WordDocument(templateFilePath);
document.BuiltinDocumentProperties.Title = "SyncFusion Word";
//Performs the mail merge
document.MailMerge.Execute(fieldNames, values);
//Creates an instance of the DocToPDFConverter
DocToPDFConverter converter = new DocToPDFConverter();
converter.Settings.EnableFastRendering = true;
converter.Settings.AutoTag = true;
converter.Settings.PreserveFormFields = true;
converter.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.Headings;
converter.Settings.EmbedCompleteFonts = true;
converter.Settings.EmbedFonts = true;
//Sets the jpeg image quality to reduce the Pdf file size
converter.Settings.ImageQuality = 100;
//Sets the image resolution
converter.Settings.ImageResolution = 640;
converter.Settings.RecreateNestedMetafile = true;
converter.Settings.OptimizeIdenticalImages = true;
converter.Settings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1A;
//Converts Word document into PDF document
PdfDocument pdfDocument = converter.ConvertToPDF(document);
pdfDocument.DocumentInformation.Language = "en-US";
pdfDocument.DocumentInformation.Title = "SyncFusion Word to PDF";
using (var memoryStream = new MemoryStream())
{
pdfDocument.Save(memoryStream);
//Close the document
pdfDocument.Close(true);
document.Close();
return memoryStream.ToArray();
}