We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Deleting image that was added by InsertImage Method

How to detect and delete image added by DocumentBuilder InsertImage Method?
Aspose.PDF has image collection in page resources for example and have simple method for image deleting. What approach I should use in Aspose.Words for my task?
Added like this:

            DocumentBuilder builder = new DocumentBuilder(document);
            builder.InsertImage(annotation.ImagePath,
                RelativeHorizontalPosition.Page,
                annotation.Box.X,
                RelativeVerticalPosition.Page,
                annotation.Box.Y,
                annotation.Box.Width,
                annotation.Box.Height,
                WrapType.Square);

@chub

The DocumentBuilder.InsertImage method returns Shape object. You can use Shape.AlternativeText property to set text e.g. ‘image by Aspose.Words’ and use this text to identify the shape and remove it using Node.Remove method. Hope this helps you.

1 Like

Thanks A lot

@chub

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.