Extract images from pdf - problem

Iam having a problem with the extract images feature of aspose.pdf.kit. Iam adding the image and pdf document as attachment. I use microsoft word 2007 to add the image to a word document and then export the document as pdf. Then i use the following code to extract the image :

Dim extractor As PdfExtractor = New PdfExtractor()
Dim pdffil As New PdfFileInfo()
pdffil.InputFile = “doc1.pdf”
extractor.BindPdf(“doc1.pdf”)
extractor.StartPage = 1
extractor.EndPage = pdffil.NumberofPages
Dim prefix As String = “image”
Dim suffix As String = “.jpg”
Dim imgcnt As Integer = 1
While extractor.HasNextImage()
extractor.GetNextImage(prefix + imgcnt + suffix)
imgcnt = imgcnt + 1
End While

but i cannot extract the images… Any idea what might be going wrong???

Hi,

We’re looking into this issue and you’ll be updated shortly.

We’re sorry for the inconvenience.
Regards,

Hi,

Please try to modify the code as shown below:


Dim extractor As New Aspose.Pdf.Kit.PdfExtractor

extractor.BindPdf(“doc1.pdf”)


extractor.StartPage = 1

extractor.EndPage = 1


extractor.ExtractImage()


Dim prefix As String = “image”

Dim imgcnt As Integer = 1

Dim suffix As String = “.jpg”


While extractor.HasNextImage()

extractor.GetNextImage(prefix + imgcnt.ToString() + suffix)

imgcnt = imgcnt + 1

End While



I tested the issue using this code snippet and it worked fine. If you have any further questions, please do let us know.
Regards,