private static void EmbeddSubsetFonts(Document doc, string dataDir)
{
// ExStart:EmbeddSubsetFonts
// To subset fonts in the output PDF document, simply create new PdfSaveOptions and set EmbedFullFonts to false.
PdfSaveOptions options = new PdfSaveOptions();
options.EmbedFullFonts = false;
dataDir = dataDir + "Rendering.SubsetFonts_out.pdf";
// The output PDF will contain subsets of the fonts in the document. Only the glyphs used
// In the document are included in the PDF fonts.
doc.Save(dataDir, options);
// ExEnd:EmbeddSubsetFonts
Console.WriteLine("\nSubset Fonts embedded successfully.\nFile saved at " + dataDir);
}
}