We have already shown you how to use uninstalled font by font document when converting word to PDF. Now starts from Spire.Doc 5.6.3, Spire.Doc newly supports to set the font styles for the uninstalled fonts when convert word documents to PDF. Here comes to the code snippets of how to set the font styles for embed the uninstalled fonts by font documents:
Note: Before Start, please download the latest version of Spire.XLS and add Spire.xls.dll in the bin folder as the reference of Visual Studio.
Step 1: Create a new workbook and load from file.
Document document = new Document(); document.LoadFromFile("Testing.docx");
Step 2: Create an instance for class ToPdfParameterList named parms.
ToPdfParameterList parms = new ToPdfParameterList();
Step 3: Define the path of the uninstalled fonts.
{ new PrivateFontPath("Century Gothic",FontStyle.Regular,"fonts\\GOTHIC.TTF"), new PrivateFontPath("Century Gothic",FontStyle.Bold,"fonts\\GOTHICB.TTF"), new PrivateFontPath("Century Gothic",FontStyle.Italic,"fonts\\GOTHICI.TTF") , new PrivateFontPath("Century Gothic",FontStyle.Bold|FontStyle.Italic,"fonts\\GOTHICBI.TTF") };
Step 4: Save the document to file and launch to preview it.
document.SaveToFile("Testing.pdf", parms); System.Diagnostics.Process.Start("Testing.pdf");
Effective screenshot of the embedded uninstalled fonts by setting the font style after converts to PDF: