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

Free Support Forum - aspose.com

Exctract Image from PDF

Dear Sir,

We have license for ASPOSE.PDF.Kit, I'm trying to use the code below to extract image from pdf file but nothing happen after excuting this code, can you help me please to figure out what's wrong ?

Aspose.Pdf.Kit.License license = new Aspose.Pdf.Kit.License();

license.SetLicense(asposeLic);

String thumbPath = fullPath + @"\Thumbnails\";

String docPath = fullPath + @"\149cf0da-057e-4f65-9762-55cdcc55dad7.pdf";

PdfExtractor extractor = new PdfExtractor();

extractor.BindPdf(docPath);

extractor.StartPage = 1;

extractor.EndPage = 1;

extractor.ExtractImage();

String prefix = thumbPath + @"\149cf0da-057e-4f65-9762-55cdcc55dad7";

String suffix = ".jpg";

int imageCount = 1;

while (extractor.HasNextImage())

{

extractor.GetNextImage(prefix + imageCount + suffix);

imageCount++;

}

do I miss some code to save the image after this code ? I can't find any example in your web site or documantation.

Thanks,

Nabeel.

sorry I just figure out that this class is to exract images from pdf file, we need to create thumbnails from pdf file if it has images or not, do you have such a class for that ?

The PDFConverter doing whatever we want but I use it 2 months ago it was fine now when I execute the code :

Aspose.Pdf.Kit.License license = new Aspose.Pdf.Kit.License();

license.SetLicense(asposeLic);

String fullFilePath = fileName;

Aspose.Pdf.Kit.PdfConverter converter = new Aspose.Pdf.Kit.PdfConverter();

converter.BindPdf(fullFilePath);

converter.DoConvert();

converter.StartPage = 1;

converter.EndPage = 1;

String suffix = ".png";

int imageCount = 1;

while (converter.HasNextImage() && imageCount == 1)

{

converter.GetNextImage(thumnailPath + suffix, ImageFormat.Png);

imageCount++;

}

converter.Close();

the line of code

converter.DoConvert();

takes forever and it doesn't do the conversion and visual studio gives time out ?

Hi Nabeel,

Your code snippets for image extraction and image conversion are both fine. First off, please make sure that you’re using the latest version at your end. Secondly, I would like to share with you that this kind of issues are sometimes caused by the particular contents or structure of the PDF file.

If the issue is not resolved with the latest version then please share the problematic PDF file with us, so we could test the issue at our end. You’ll be updated with the resolution accordingly.

We’re sorry for the inconvenience.
Regards,

I’ve tried the latest version of the PDFConverter and it is taking forever and never convert the file, please note this was working before like 2 months ago, I have tried differant pdf files for testing

Hi Nabeel,

I have tested this issue at my end but couldn’t notice any problem with the sample files with me. Could you please share one such sample problematic PDF file with us? In fact, it is very important for our team to reproduce the issue using your particular scenario before resolving it.

We’re sorry for the inconvenience and appreciate your cooperation.
Regards,

Send me your email address so I can send you the files.

Hi Nabeel,

You can either mark the thread as private and attach the file with your reply post or you can send the file to me using ‘Contact -> Send shahzad.latif and email’ option at the top of this post.

I hope this helps.
Regards,