DwfImage.RemoveElement

DwfImage.RemoveElement method

Removes graphic element from specified page. Provides the ability to remove a graphic element from the image. To remove it, you need to specify the page index in Pages array from which the element should be removed and the index of the element in Entities array.

public void RemoveElement(int pageNumber, int elementIndex)
ParameterTypeDescription
pageNumberInt32Index of page in Pages array to remove element from.
elementIndexInt32Index of element to be removed.

Examples

Removes last graphic element from the first page of the image.

string fileName = "exampleFile";
string file = string.Format("{0}.dwf", fileName);
string outFile = string.Format("{0}.png", fileName);

using (FileStream inStream = new FileStream(file, FileMode.Open))
using (DwfImage image = (DwfImage) Image.Load(inStream))
using (FileStream stream = new FileStream(outFile, FileMode.Create))
{
    image.RemoveElement(0, image.Pages[0].Entities.Length-1);

    ImageOptionsBase options = new PngOptions();
    options.VectorRasterizationOptions = new CadRasterizationOptions
                                             {
                                                 DrawType = CadDrawTypeMode.UseObjectColor,
                                             };

    image.Save(stream, options);
}

See Also