'''' This code is part of Document Solutions for PDF .NET demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsGrapeCity.Documents.Pdf PublicClassRemoveSquareImagesPublicFunctionCreatePDF(ByVal stream AsStream) AsIntegerUsing fs = File.OpenRead(Path.Combine("Resources", "PDFs", "SlidePages.pdf"))Dim doc = NewGcPdfDocument() doc.Load(fs)' Get the list of images in the document:Dim imageInfos = doc.GetImages()' Remove non-square images from the list:For i = imageInfos.Count - 1To0Step -1If imageInfos(i).Image.Width <> imageInfos(i).Image.HeightThen imageInfos.RemoveAt(i)EndIfNext' Remove images left in the list from the PDF: doc.RemoveImages(imageInfos)'' Done: doc.Save(stream)Return doc.Pages.CountEndUsingEndFunctionEndClass