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

Free Support Forum - aspose.com

Extract Image from pdf

Hi,

I used the following code to extract the image from pdf in jpeg format. There is some text and a barcode in the pdf file. The text and barcode in the extracted image is expanded. Its not in its original form. When I take printscreen manually from the pdf, everything is in its original shape. Could you please take a look into the code below and the attached pdf and jpeg files.

PdfExtractor extractor = new PdfExtractor();

//Bind the input PDF document to extractor

extractor.BindPdf(@"c:\temp\barcode.pdf");

//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 = 1;

//Extract images from the input PDF document

extractor.ExtractImage();

//A variable to count number of extracted images

int imageCount = 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("c:\\Barcode.jpeg");

//Incrementing image counter variable

imageCount++;

}

Hi,

Thank you for reporting this.

I'm able to reproduce the same error and will discuss about it with other developrs.As a workaround, please use the method of PdfConverter(by which the result would be ok ) instead of PdfExtractor.

Thanks,

Hi.

The PdfConverter did it as expected. Thanks.