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

Free Support Forum - aspose.com

How to delete image by its position


Is there any way to delete image by its position?
By using Pdf.Pages(1).Resources.Images(i).delete, this is only to delete image by size.
Could you provide me some demo?


Would you kindly provide your sample PDF document. We will test the scenario in our environment and share our feedback with you accordingly.

I try this way:
Dim abs As ImagePlacementAbsorber = New ImagePlacementAbsorber()
Dim PH as integer=Pdf.Pages§.Rect.Height
Dim Index as integer
For Each imagePlacement As ImagePlacement In abs.ImagePlacements
Dim x As Integer = ImagePlacement.Rectangle.LLX
Dim H as integer =ImagePlacement.Rectangle.Height
Dim y As Integer = PH - ImagePlacement.Rectangle.LLY - H ’ this is the real y position, please fix this bug.
Index =Index +1
if x<30 and y<30 then ’ the (x,y) is the position of the image
'delete the image at close to upper left conner, but it fail to delete the image on old version of pdf.dll, whereas the old version of dll can get the image count =7(there are 8 images in the pdf page)
end if

when try the same code on pdf.dll v20.7, it got none of any image in the page, but if there is image detected in the page, it can delete them, but the image index may be wrong when call Pdf.Pages§.Resources.Images.Delete(Index), which exists a bug for version 20.7!

please check it and fix the bug.

Doc1.pdf (287.9 KB)


We have observed that API was able to detect 7 images inside the PDF page (Would you please make sure to use a valid license while testing the scenario). However, we noticed that the indices of the images were being wrongly calculated. For the sake of further investigation, we have logged an issue as PDFNET-48615 in our issue tracking system. We will further check it and let you know as soon as it is resolved.

We are sorry for the inconvenience.