page 261

How to Remove Slides from a Presentation

2014-05-29 02:12:28 Written by Koohji

Sometimes, we may need to delete specific slide in a PowerPoint presentation due to any reason. This section will illustrate that how we can accomplish that task using Spire.Presentation for .NET.

As a matter of fact, it is quite easy and convenient to remove slides by only one line of core code if you have Spire.Presentation.Dll installed as a reference in your .NET project assemblies. Here is the method:

Step 1: Create an instance of presentation class and load PPT documents

Presentation presentation = new Presentation();
presentation.LoadFromFile("sample.pptx");

Step 2: Remove the second slide from the presentation by using its index position

presentation.Slides.RemoveAt(1);

Step 3: Save and review

presentation.SaveToFile("result.pptx",FileFormat.Pptx2010);
System.Diagnostics.Process.Start("result.pptx");

Original layout:

Remove Slides from a Presentation

Result:

Remove Slides from a Presentation

Full C# code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spire.Presentation;

namespace RemoveSlide
{
    class Program
    {
        static void Main(string[] args)
        {
            Presentation presentation = new Presentation();
            presentation.LoadFromFile("sample.pptx");

            //remove the second slide
            presentation.Slides.RemoveAt(1);

             presentation.SaveToFile("result.pptx",FileFormat.Pptx2010);
            System.Diagnostics.Process.Start("result.pptx");
        }
    }
}

Delete Annotation from PDF files in C#

2014-05-27 08:40:59 Written by Koohji

Text annotation is often used in PDF file to show readers the extra information of the item. By using Spire.PDF you can not only add a new annotation, edit an existing annotation, but also delete annotations from PDF file. In this article, we will introduce you how to delete a particular annotation and delete all the annotation at one time.

First, check the PDF document with annotations.

Delete Annotation from PDF files in C#

Here comes to the steps of how to remove the bookmarks in C#.

  • Download Spire.PDF for .NET and install it correctly. The Spire.PDF installation is clean, professional and wrapped up in a MSI installer.
  • Add Spire.Pdf.dll as reference in the downloaded Bin folder though the below path: "..\Spire.Pdf\Bin\NET4.0\ Spire.Pdf.dll".
  • Check the code snippet of how to delete the annotations. With Spire.PDF.NET, we can remove both the particular annotation and remove all the annotations.

The code snippet of remove the first annotation from PDF file:

PdfDocument document = new PdfDocument();
//load the pdf file
document.LoadFromFile("E-iceblue.pdf");

//remove the first annotation
document.Pages[0].Annotations.RemoveAt(1);

document.SaveToFile("result.pdf");
System.Diagnostics.Process.Start("result.pdf");

The effective screenshot of remove the first annotation:

Delete Annotation from PDF files in C#

The code snippet of remove all annotations from PDF file:

PdfDocument document = new PdfDocument();
//load the pdf file
document.LoadFromFile("E-iceblue.pdf");

//remove all annotations
document.Pages[0].Annotations.Clear();

document.SaveToFile("result.pdf");
System.Diagnostics.Process.Start("result.pdf");

The effective screenshot of remove all the annotations:

Delete Annotation from PDF files in C#

How to add Controls to Toolbox in C#

2014-05-26 02:47:28 Written by Koohji

In this document, I will introduce you how to add Spire. Barcode controls to Toolbox for Windows Forms application.

If you have already installed Spire.Barcode, you can add controls this way:

"Start" → "Programs" → "e-iceblue" → "Spire.Barcode": Click "Add Controls into VS Toolbox".

How to add Controls to Toolbox

Click "Add" to add controls.

How to add Controls to Toolbox

Right-click on the blank part of the Toolbox - "Add Ta" - name the new Tab "Spire Controls":

How to add Controls to Toolbox

Right-click on the blank part below "Spire Controls" → "Choose Items" → ".NET Framework Components" → "Browse" to the "Bin" folder → find the file "Spire.Barcode.dll" → "Open".

How to add Controls to Toolbox

Click "OK". Then you have added controls to Toolbox successfully.

How to add Controls to Toolbox

page 261