Free Support Forum - aspose.com

Aspose.PDF.Kit - ExtractImage; blank image

Hi,

Using the code sample on the site I have had mixed success extracting images - some PDFs work well, but one PDF in particular is saving and returning a completely black JPG where the image should be. Any thoughts?

Barry Cranston


This message was posted using Support 2 Forum

Hi,

Thank you for considering Aspose.

Can you please send your sample Pdf that is creating a problem, we will check and let you know.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

File attached,

Thanks

Hi,

I am unable to reproduce the error. I have checked it with version 2.5.1.0. Please make sure you are using the latest version of Aspose.Pdf.Kit. For your reference I used the following code:

PdfConverter converter = new PdfConverter();

converter.BindPdf("D:/AsposeTest/EnergyPerformanceCertificateSample_id1500761.pdf");

converter.DoConvert();

String prefix = "D:/AsposeTest/";

String suffix = ".jpg";

int imageCount = 1;

while (converter.HasNextImage())

{

converter.GetNextImage(prefix + imageCount + suffix);

imageCount++;

}

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,

Thanks for that, however, it is the individual image extraction that is the problem, rather than the conversion of each page into an image. See code snippet, which generates the problem, using version 2.5.0.0.

Try

'Set up licensing

Dim myLicense As Aspose.Pdf.Kit.License = New Aspose.Pdf.Kit.License

myLicense.SetLicense("Aspose.Pdf.Kit.lic")

'Instantiate PdfExtractor object

Dim extractor As PdfExtractor = New PdfExtractor()

Dim inputfile As String = "C:\FileDrop\EPC.pdf"

'Bind the input PDF document to extractor

extractor.BindPdf(inputfile)

'Set the Number of Page in PDF document from where to start image extraction

extractor.StartPage = 1

'Set the Number of Page in PDF document, where to end image extraction

extractor.EndPage = 2

'Extract images from the input PDF document

extractor.ExtractImage()

'A variable to store the prefix (First Part usually file name) of the image file name

Dim prefix As String = "ImageFile"

'A variable to count number of extracted images

Dim suffix As String = ".jpg"

'A variable to count number of extracted images

Dim imageCount As Integer = 1

'Calling HasNextImage method in while loop. When images will finish, loop will exit

While extractor.HasNextImage()

'Call GetNextImage method to store image as a file

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

'Incrementing image counter variable

imageCount = imageCount + 1

End While

Catch ex As Exception

Console.WriteLine(ex.Message)

Console.ReadLine()

End Try

Hi,

I am able to reproduce the error. I will discuss this with the developers and we will inform you of a solution as soon as possible.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Any update on this?

Hi,

This problem hasn't been resolved yet, our developers are working hard to find the root cause of this issue. We will let you know as soon as solution is found.

Thanks for patience.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Its been another month - I'm less than impressed, and am now looking for alternate solutions, which I will be sure to share on the forums at every opportunity - this gives you a very small window in which to save this sale, and turn around a disatisfied customer.

Hi,

I am very sorry about this, we will try to let you know by tomorrow about the progress on this issue. Sorry for inconvenience.

Thanks.

Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html

Hi,

We have found the reason to cause this problem and working hard on this issue now. We hope it will be fixed in about 2 weeks.

Best Regards.

Wondering if this issue has been resolved?

Thanks,

Hi,

We have meet some technology problem. We hope it will be fixed in the end of this month.

Best Regards.

Please download hotfix 2.6.1.

Hello

I have downloaded the hotfix and still get all black images.

Thanks

Hi,

I have tested it with the download hotfix again and can extract images. Did you uninstall the old version of Aspose.Pdf.Kit before you using the new hotfix?