PDF Viewer for Aspose.PDF for Android

Hi,

Is there no way to display a PDF using Aspose.pdf library?

There is a need for a PDF viewer on Android OS & the existing solutions such as Qoppa or MuPDF are not dev friendly by any means.

Is adding a viewer on your future release agenda?

Thank you,
Sireesha

Hi Sireesha,


Thanks for your inquiry. I am afraid providing viewer/GUI for PDF files is out of scope of Aspose.Pdf as Aspose is API vendor its APIs are class libraries that can be embedded into the applications to enable file formatting features in the applications. However, you may consider our sister concern company, GroupDocs, for the purpose.

We are sorry for the inconvenience.

Best Regards,

Hi Sireesha,


Adding more to Tilal’s comments, you may consider converting PDF pages to Image format and then display the images in your Android app. You may consider using the following code snippet.

[Java]

//open
document
<o:p></o:p>

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document("input.pdf");

// create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream("Converted_Image.jpg");

//create JPEG device with specified attributes

//Quality [0-100], 100 is Maximum

//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(pdfDocument.getPages().get_Item(1), imageStream);

//close the stream

imageStream.close();