'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.DrawingImportsSystem.LinqImportsSystem.Collections.ImmutableImportsSystem.Collections.GenericImportsGrapeCity.Documents.PdfImportsGrapeCity.Documents.Pdf.TextImportsGrapeCity.Documents.Text PublicClassFontEmbeddingStatusPublicFunctionCreatePDF(ByVal stream AsStream) AsIntegerConstpdfNameAsString = "C1Olap-QuickStart.pdf"Dim fs = File.OpenRead(Path.Combine("Resources", "PDFs", pdfName))Dim doc = NewGcPdfDocument() doc.Load(fs) Dim page = doc.Pages.Insert(0)Dim g = page.GraphicsDim tl = g.CreateTextLayout() tl.AppendLine($"Fonts used in {pdfName}, and their embedding status:" & vbLf)' List fonts and their embedding states:Dim ff = doc.GetFonts().ToImmutableArray().Select(Function(f_) GetFontInfo(f_)).DistinctBy(Function(fi_) fi_.Item2).OrderBy(Function(fi_) fi_.Item2)ForEach fi In ff tl.AppendLine($"- ""{fi.Item2}"": {EmbedModeToString(fi.Item1)}")Next tl.MarginAll = g.Resolution g.DrawTextLayout(tl, PointF.Empty) doc.Save(stream)Return doc.Pages.CountEndFunction PrivateFunctionGetFontInfo(font AsGrapeCity.Documents.Pdf.Text.Font) As (FontEmbedMode, String)If font.IsEmbeddedThenDim p = font.BaseFont.IndexOf("+"c)If p > 0ThenReturn (FontEmbedMode.EmbedSubset, font.BaseFont.Substring(p + 1))ElseReturn (FontEmbedMode.EmbedFullFont, font.BaseFont)EndIfEndIfReturn (FontEmbedMode.NotEmbed, font.BaseFont)EndFunction PrivateFunctionEmbedModeToString(fem AsFontEmbedMode) AsStringIf fem = FontEmbedMode.EmbedFullFontThenReturn"Embedded font"ElseIf fem = FontEmbedMode.EmbedSubsetThenReturn"Embedded subset"ElseReturn"Not embedded"EndIfEndFunctionEndClass