RemoveAllImages.cs
C# VB
//// This code is part of Document Solutions for PDF .NET demos.// Copyright (c) MESCIUS inc. All rights reserved.//using System.IO;using GrapeCity.Documents.Pdf;
namespace DsPdfWeb.Demos{ // This demo shows how to remove all images from a PDF using the GcPdfDocument.RemoveImages() method. public class RemoveAllImages { public int CreatePDF(Stream stream) { using var fs = File.OpenRead(Path.Combine("Resources", "PDFs", "Wetlands.pdf")); var doc= new GcPdfDocument(); doc.Load(fs); // Get the list of images in the document: var imageInfos = doc.GetImages(); // Remove all images: doc.RemoveImages(imageInfos); // Done: doc.Save(stream); return doc.Pages.Count; } }}