Remove PDF Page in C#, VB.NET

A PDF document is presented with pages and users draw text, image or other objects on these pages. Sometimes, users would like to remove pages with bad-drawn objects or some irrelevant contents to topic the document demonstrates. This guide will present a simple way to remove PDF page in C# and VB.NET Basic via Spire.PDF for .NET. And the following screenshot presents the original document with no page removed.

Remove PDF Page

Spire.PDF for .NET, a professional .NET PDF component, provides a method PdfPageCollection.RemoveAt to remove specified PDF page. The overload passed to this method is page index. For example, if you want to remove the first page, the overload should be 0. Download and install Spire.PDF for .NET and follow the code to remove PDF page.

using Spire.Pdf;

namespace Remove
    class Program
        static void Main(string[] args)
            //Load PDF
            PdfDocument document = new PdfDocument();
            document.LoadFromFile(@"E:\Microsoft Word 2013 Preview.pdf");

            //Remove First Page

            //Save and Launch
Imports Spire.Pdf

Namespace Remove
    Friend Class Program
        Shared Sub Main(ByVal args() As String)
            'Load PDF
            Dim document As New PdfDocument()
            document.LoadFromFile("E:\Microsoft Word 2013 Preview.pdf")

            'Remove First Page

            'Save and Launch
        End Sub
    End Class
End Namespace

After debugging, you can find that the first page has been removed as the following screenshot.

Remove PDF Page

Spire.PDF, a stand-alone PDF document component, enables developers/programmers to generate, draw, modify and save PDF documents in .NET, Silverlight and WPF by using C# and VB.NET without Adobe Acrobat.