Issue in PDF to Image conversion

Hi,

I have downloaded aspose trail version for converting pdf to image and image to pdf. When I am converting pdf to image than some files are converted and some are not. Means most of the files I found is not converting to png or any image type.

Hi Tarang,


Thanks for your interest in our products.

Can you please share the sample PDF files causing this problem so that we can test the scenario at our end. we apologize for your inconvenience.

The problem might be related to structure and complexity of input PDF documents.

Hi,


Thanks for the reply. I am attaching one of the pdf file in which I am getting problem.

Thanks,
Tarang

Hi Tarang,

Thanks for sharing the resource file.

I have tested the scenario using the following code snippet with the latest release of Aspose.Pdf for .NET 8.6.0 and I am unable to notice any issue. The file is properly being converted to Image format. For your reference, I have also attached the resultant Image generated over my end.

C#

//open document
Document pdfDocument = new Document("c:/pdftest/Prueba+1.PDF");

for (int pageCount = 1; pageCount <= pdfDocument.Pages.Count; pageCount++)
{
    using (FileStream imageStream = new FileStream("c:/pdftest/Prueba+1_image" + pageCount + ".jpg", FileMode.Create))
    {
        Resolution resolution = new Resolution(300);
        JpegDevice jpegDevice = new JpegDevice(resolution, 100);
        //convert a particular page and save the image to stream
        jpegDevice.Process(pdfDocument.Pages[pageCount], imageStream);
        //close stream
        imageStream.Close();
    }
}

Hi,


Thanks for the reply and this worked for me as well. One more thing, can we set image quality in program so that image becomes more clear.

Thanks,
Tarang

Hi Tarang,


Thanks for your feedback. You can increase the resolution value to increase quality of image but it depends more upon the scanned image quality of your source document. Please not increasing resolution will also increase the file size.

Please feel free to contact us for any further assistance.

Best Regards,