//// 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{// This sample shows how to convert all text in an existing PDF to glyph outlines.// The resulting PDF will look exactly like the original, but all glyphs in it// will be rendered as graphics paths. This can be used to manipulate the paths,// or to make sure it will be impossible to copy or search the text.// Note that the resulting documents will have no fonts (see for example // the Document Properties | Fonts tab in DsPdfViewer). // The original PDF used by this sample was generated by Wetlands.publicclassTextToOutlines {publicintCreatePDF(Stream stream) {usingvar fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands.pdf"));// Load the source PDF into a temp document:var srcDoc = newGcPdfDocument(); srcDoc.Load(fs);// Draw all pages of the source document on pages of the new PDF:var doc = newGcPdfDocument();foreach (var srcPage in srcDoc.Pages) {var page = doc.Pages.Add(srcPage.Size);// Setting Graphics.DrawTextAsPath to true makes all glyphs draw as graphics paths// instead of rendering text using fonts: page.Graphics.DrawTextAsPath = true;// Draw the source page on the target: srcPage.Draw(page.Graphics, srcPage.Bounds); }// Done: doc.Save(stream);return doc.Pages.Count; } }}