<commit_before>﻿using System;
using System.IO;
using System.Reflection;
using Aspose.Words.Fonts;
using Aspose.Words;
using Aspose.Words.Saving;
namespace Aspose.Words.Examples.CSharp.Rendering_and_Printing
{
    class EmbeddedFontsInPDF
    {
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_RenderingAndPrinting();
            
            EmbeddAllFonts(dataDir);
            EmbeddSubsetFonts(dataDir);
            SetFontEmbeddingMode(dataDir);
        }

        private static void EmbeddAllFonts(string dataDir)
        {
            // ExStart:EmbeddAllFonts
            // Load the document to render.
            Document doc = new Document(dataDir + "Rendering.doc");

            // Aspose.Words embeds full fonts by default when EmbedFullFonts is set to true. The property below can be changed
            // Each time a document is rendered.
            PdfSaveOptions options = new PdfSaveOptions();
            options.EmbedFullFonts = true;

            string outPath = dataDir + "Rendering.EmbedFullFonts_out.pdf";
            // The output PDF will be embedded with all fonts found in the document.
            doc.Save(outPath, options);
            // ExEnd:EmbeddAllFonts
            Console.WriteLine("\nAll Fonts embedded successfully.\nFile saved at " + outPath);
        }

        private static void EmbeddSubsetFonts(string dataDir)
        {
            // ExStart:EmbeddSubsetFonts
            // Load the document to render.
            Document doc = new Document(dataDir + "Rendering.doc");

            // 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";
<commit_msg>Update EmbeddedFontsInPDF.cs<commit_after>﻿using System;
using System.IO;
using System.Reflection;
using Aspose.Words.Fonts;
using Aspose.Words;
using Aspose.Words.Saving;
namespace Aspose.Words.Examples.CSharp.Rendering_and_Printing
{
    class EmbeddedFontsInPDF
    {
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_RenderingAndPrinting();
            
            EmbeddAllFonts(dataDir);
            EmbeddSubsetFonts(dataDir);
            SetFontEmbeddingMode(dataDir);
        }

        private static void EmbeddAllFonts(string dataDir)
        {
            // ExStart:EmbeddAllFonts
            // Load the document to render.
            Document doc = new Document(dataDir + "Rendering.doc");

            // Aspose.Words embeds full fonts by default when EmbedFullFonts is set to true. The property below can be changed
            // Each time a document is rendered.
            PdfSaveOptions options = new PdfSaveOptions();
            options.EmbedFullFonts = true;

            string outPath = dataDir + "Rendering.EmbedFullFonts_out.pdf";

            // The output PDF will be embedded with all fonts found in the document.
            doc.Save(outPath, options);
            // ExEnd:EmbeddAllFonts
            Console.WriteLine("\nAll Fonts embedded successfully.\nFile saved at " + outPath);
        }

        private static void EmbeddSubsetFonts(string dataDir)
        {
            // ExStart:EmbeddSubsetFonts
            // Load the document to render.
            Document doc = new Document(dataDir + "Rendering.doc");

            // 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";

{'fraction_non_alphanumeric': 0.07170393215111796, 'fraction_numerical': 0.0, 'mean_word_length': 2.1463217461600648, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4551730', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1019, 'n_words': 295}