// 完毕:
using System;
using System.IO;
using System.Drawing;
using System.Text;
using GrapeCity.Documents.Pdf;
using GrapeCity.Documents.Text;
using GrapeCity.Documents.Drawing;
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);
// 完毕:
doc.Save(stream);
return doc.Pages.Count;
}
}
}