'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.DrawingImportsSystem.Collections.GenericImportsGrapeCity.Documents.PdfImportsGrapeCity.Documents.Pdf.Graphics.ImagesImportsGrapeCity.Documents.Pdf.SpecImportsGrapeCity.Documents.Text PublicClassGetImagePropertiesPublicFunctionCreatePDF(ByVal stream AsStream) AsIntegerUsing fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands.pdf"))Dim docSrc = NewGcPdfDocument() docSrc.Load(fs) ' Get the images in the loaded PDF and print their info into the resulting PDF:Dim imageInfos = docSrc.GetImages() ' The PDF to hold the results:Dim doc = NewGcPdfDocument()Dim page = doc.NewPage()' Set up a TextLayout to format the results:Dim tl = page.Graphics.CreateTextLayout() tl.DefaultFormat.Font = StandardFonts.Courier tl.DefaultFormat.FontSize = 14 tl.MaxWidth = doc.PageSize.Width tl.MaxHeight = doc.PageSize.Height tl.MarginAll = tl.ResolutionDim captionFmt = NewTextFormat(tl.DefaultFormat) With {.Font = StandardFonts.CourierBold, .FontSize = tl.DefaultFormat.FontSize + 2} Dim i AsInteger = 0ForEach imageInfo In imageInfos i += 1 tl.AppendLine($"Image {i}", captionFmt) ' PdfImageBase class represents an image in the loaded PDF file:Dim img AsPdfImageBase = imageInfo.Image tl.AppendLine($"PdfImage object ID: {img.ObjID}")' PdfImageBase is derived from PdfDictWrapper type, it has methods' that allow you to access properties/data of the underlying PDF stream object:Using psi AsPdfStreamInfo = img.GetPdfStreamInfo() tl.AppendLine($" Image stream length: {psi.Stream.Length}") tl.AppendLine($" ImageFilterName: {psi.ImageFilterName}") tl.AppendLine($"ImageFilterDecodeParams: {psi.ImageFilterDecodeParams}")' Dump the content of the ImageFilterDecodeParams if it exists:If psi.ImageFilterDecodeParamsIsNotNothingThenForEach kvp In psi.ImageFilterDecodeParams.Dict tl.AppendLine($"{kvp.Key}: {kvp.Value}")Next' An example of how to get the value of BlackIs1:Dim blackIs1 = psi.ImageFilterDecodeParams.GetBool(PdfName.Std.BlackIs1, Nothing) tl.AppendLine($"BlackIs1: {blackIs1}")EndIfEndUsing' Dump the properties of PdfImage dictionary: tl.AppendLine() tl.AppendLine("Properties of PdfImage dictionary:")ForEach kvp AsKeyValuePair(OfPdfName, IPdfObject) In img.PdfDict.Dict tl.AppendLine($"{kvp.Key}: {kvp.Value}")Next'Dim cs = img.Get(OfIPdfObject)(PdfName.Std.ColorSpace) tl.AppendLine($"ColorSpace: {cs.GetType().Name}{cs}")Dim bpc = img.Get(OfIPdfObject)(PdfName.Std.BitsPerComponent) tl.AppendLine($"BitsPerComponent: {bpc?.GetType().Name}{bpc}") tl.AppendLine()Next ' Render the results: tl.PerformLayout(True)DoDim rest AsTextLayout = NothingDim splitResult = tl.Split(Nothing, rest) page.Graphics.DrawTextLayout(tl, PointF.Empty)If splitResult <> SplitResult.SplitThenExitDoEndIf tl = rest tl.MarginTop = tl.Resolution page = doc.Pages.Add()Loop ' Append the source PDF to the result for reference: doc.MergeWithDocument(docSrc) '' Done: doc.Save(stream)Return doc.Pages.CountEndUsingEndFunctionEndClass