XDoc.PDF
Features
Tech Specs
How-to C#
Pricing
How to Start Convert PDF Read PDF Build PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

C# PDF Page Parser SDK
How to parse, delete, remove, save PDF pages using C#.net


Full sample C# source code for deleting pages from Adobe PDF document in C#. Free Online Trial Download










  • Best C#.NET PDF Editor Contrl for deleting PDF pages in Visual Studio .NET program
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Advanced component and library able to delete PDF page in both Visual C# .NET WinForms and ASP.NET WebForms project
  • Free online C# class source code for deleting specified PDF pages in .NET console application
  • Able to remove a single page or a range of pages from PDF document
  • Ability to remove extra blank pages from PDF files
  • Free trial package for quick integration in .NET as well as compatible with 32 bit and 64 bit windows system


C#.NET PDF document page deleting library control (XDoc.PDF) can be easily integrated into any C#.NET class applications to delete any unnecessary page from target existing PDF document file. Using RasterEdge Visual C# .NET PDF page deletion component, developers can easily select one or more PDF pages and delete it/them in both .NET web and Windows applications.


C#.NET PDF page removing & deleting library control SDK is a mature component on the market, which can also provides other PDF document page processing functions, such as PDF document merging function, PDF page rotating function, PDF page inserting function, PDF page reordering function and PDF document splitting function.


This tutorial offers three pieces of C# sample codes for PDF page(s) deletion. XDoc.PDF enables you to delete PDF page(s) with customized options, including setting a single page, a series of pages, and random pages to be removed from PDF file.







C# delete a page from pdf file


        #region delete one page from pdf file
        internal static void deleteOnePageFromPdf()
        {
            String filepath = @"";
            String outPutFilePath = @"";
            PDFDocument doc = new PDFDocument(filepath);

            // Detele page 2 (actually the third page).
            doc.DeletePage(2);

            // Save the file.
            doc.Save(outPutFilePath);
        }
        #endregion




C# delete pages with specified page range from pdf file


        #region delete pages with specified page range from pdf file
        internal static void deletePagesWithRangeFromPdf()
        {
            String filepath = @"";
            String outPutFilePath = @"";
            PDFDocument doc = new PDFDocument(filepath);

            // Detele a series of 3 pages, starting from the second page. 
            doc.DeletePages(1, 3);

            // Save the file.
            doc.Save(outPutFilePath);

        }
        #endregion




C# delete specified pages from pdf file


        #region delete specified pages from pdf file
        internal static void deleteSpecifiedPagesFromPdf()
        {
            String filepath = @"";
            String outPutFilePath = @"";
            PDFDocument doc = new PDFDocument(filepath);

            // Get PageIndexes.
            int[] detelePageindexes = new int[] { 1, 3, 5, 7, 9 };

            // Delete pages.
            doc.DeletePages(detelePageindexes);

            // Save the file.
            doc.Save(outPutFilePath);
        }
        #endregion




Delete a page in a PDFDocument object at specified position


//  get PDFDocument object from a source file
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);

//  delete the 3rd page
int pageIndex = 2;
doc.DeletePage(pageIndex);

//  save the PDFDocument
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";
doc.Save(outputFilePath);




Delete consecutive pages in a PDFDocument object


//  get PDFDocument object from a source file
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);

//  detele consecutive 3 pages from the 2nd page
int pageIndex = 1;
int pageCount = 3;
doc.DeletePages(pageIndex, pageCount);

//  save the PDFDocument
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";
doc.Save(outputFilePath);




Delete pages in a PDFDocument object


//  get PDFDocument object from a source file
String inputFilePath = Program.RootPath + "\\" + "1.pdf";
PDFDocument doc = new PDFDocument(inputFilePath);

//  delete 5 pages by their page indexes
int[] pageIndexes = new int[] { 1, 3, 5, 7, 9 };
//delete pages
doc.DeletePages(pageIndexes);

//  save the PDFDocument
String outputFilePath = Program.RootPath + "\\" + "Output.pdf";
doc.Save(outputFilePath);