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

Free Support Forum - aspose.com

Convert PDF to Image using Aspose.PDF for Android via Java

I have tried your PDF to image library for android but that is giving exception.

Hi Sandeep,


Thanks for contacting support.

Can you please share some details regarding the issue (exception details) which you are facing and sample PDF documents, so that we can test the scenario in our environment. We apologize for this inconvenience.

Hi,

I have used your pdf document and library. I am attaching activity file, sample pdf file and exception screen on mobile. Please rectify this.


Regards

Sandeep kaushal

Hi Sandeep,


Thanks for sharing the sample project. We are testing the scenario in our environment and will share our findings, shortly.

Hi Sandeep,


Thanks for your patience.

I have tested the scenario using Aspose.Pdf for Android 1.4.0 over Windows 7 (x64) and I am unable to notice any exception when converting my.pdf file to Image format. However I have observed that resultant image is blank. For the sake of correction, I have logged this problem
as PDFANDROID-268 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.

I have used following code snippet for conversion process.

[Java]

String outputPath=Environment.getExternalStorageDirectory().getPath();<o:p></o:p>

com.aspose.pdf.Document pdfDocument1 = new com.aspose.pdf.Document(Environment.getExternalStorageDirectory().getPath()+"/my.pdf");

// Loop through all the pages of PDF file

for (int pageCount = 1; pageCount <= pdfDocument1.getPages().size(); pageCount++)

{

// Create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream(Environment.getExternalStorageDirectory().getPath()+"/my_Converted_Image" + pageCount + ".jpg");

// Create Resolution object

com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(300);

// Create JpegDevice object where second argument indicates the quality of resultant image

com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 100);

// Convert a particular page and save the image to stream

jpegDevice.process(pdfDocument1.getPages().get_Item(pageCount), imageStream);

// Close the stream

imageStream.close();

}

Hi,

Please provide me complete source code and API.

Hi,

The same issue I am also facing giving empty image while converting from pdf to image.

sandeepkaushal:
Please provide me complete source code and API.
Hi Sandeep,

Thanks for contacting support.

Please download the latest release of Aspose.Pdf for Android 1.5.0 and the code snippet to convert PDF pages to Image format is shared in earlier post.

sandeepkaushal:
The same issue I am also facing giving empty image while converting from pdf to image.
Hi,

As shared earlier, I have also managed to notice that when converting my.pdf (which you have shared earlier), the resultant images are blank. For the sake of correction, this problem is already logged as PDFANDROID-268 in our issue tracking system. As soon as we have made some definite progress towards its resolution, we will update you within this forum thread.

We are really sorry for this delay and inconvenience.