RemoveEmbedFonts.cs
//
// This code is part of Document Solutions for Word demos.
// Copyright (c) MESCIUS inc. All rights reserved.
//
using System;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using GrapeCity.Documents.Word;

namespace DsWordWeb.Demos
{
    // This sample shows how to enumerate and remove embedded font data from a DOCX.
    // Compare the size of the resulting DOCX with the size of the original "EmbedFonts.docx".
    public class RemoveEmbedFonts
    {
        public GcWordDocument CreateDocx()
        {
            GcWordDocument doc = new GcWordDocument();

            // Load a DOCX that contains embedded font:            
            doc.Load(Path.Combine("Resources", "WordDocs", "EmbedFonts.docx"));

            // Enumerate the embedded fonts:
            foreach (var fi in doc.Fonts)
            {
                // Remove all embedded fonts:
                fi.Embedded.Clear();
            }

            // Done:
            return doc;
        }
    }
}