//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingGrapeCity.Documents.Pdf; namespaceDsPdfWeb.Demos.Basics{// This example shows how to convert an existing PDF that does not// have fonts embedded into the PDF with embedded fonts.publicclassAddEmbeddedFonts {publicintCreatePDF(Stream stream) {// Load a PDF that does not have embedded fonts:usingvar fs = File.OpenRead(Path.Combine("Resources", "PDFs", "CompleteJavaScriptBook-nofonts.pdf"));var docSrc = newGcPdfDocument(); docSrc.Load(fs); // Create a new document and draw each page of the original PDF into it:var doc = newGcPdfDocument();// Not really needed as EmbedSubset is the default for new GcPdfDocument:// doc.FontEmbedMode = FontEmbedMode.EmbedSubset;foreach (var p in docSrc.Pages) {var pNew = doc.NewPage(); pNew.Size = p.Size; pNew.Graphics.DrawPdfPage(p, p.Bounds); } // Done: doc.Save(stream);return doc.Pages.Count; } }}