Free Support Forum - aspose.com

Unable to extract image from this PDF

Aspose.Pdf.Kit.PdfExtractor (3.4.0.0) aspose is unable to extract the image from the attached PDF.

The code below works for many other PDF files. The attached file is just one of many like it that do fail. Any reason, explaination, workarounds will be appreciated.

The code:

Dim pdfExtract As New Aspose.Pdf.Kit.PdfExtractor
Dim pdfFileInfo As New Aspose.Pdf.Kit.PdfFileInfo(WorkFN)

If pdfFileInfo.BePdfFile AndAlso Not pdfFileInfo.BeEncrypted Then

pdfFileInfo.ClearInfo()
pdfFileInfo = Nothing

pdfExtract.BindPdf(WorkFN)
pdfExtract.ExtractText()

Dim textData As String = String.Empty
If pdfExtract.HasNextPageText Then
Dim txtStream As New IO.MemoryStream
pdfExtract.GetText(txtStream)
textData = UtilityToolkit.Strings.ByteArrayToString(txtStream.ToArray, True)
End If

pdfExtract.BindPdf(WorkFN)
pdfExtract.ExtractImage()

Dim pdfTifFN As String = System.IO.Path.ChangeExtension(WorkFN, ".tif")
Dim pdfPageFN As String = pdfTifFN.Replace(".tif", "_page.tif")
Dim firstPage As Boolean = True

While pdfExtract.HasNextImage
' doesn't matter what is in the loop, because .HasNextImage returns false
End While

Hi Stan,

I have tested and reproduced the issue at my end and logged it as PDFKITNET-9377 in our issue tracking system. Our development team will be looking into the issue and you will be updated with the resolution.

We're sorry for the inconvenience.

Regards,

Thanks for the update.

(For my future sanity, our tracking number for this is HRC8511)

Hi Stan,

We have worked on issue, however as this file doesn’t contain any images, rather only contains the graphics commands, so no images can be extracted using Aspose.Pdf.Kit. Please try to convert this file to images using PdfConverter class. I hope this will resolve your issue.

If you have any further questions, please do let us know.
Regards,