Convert PDF to JPEG via Android via Java

PDF to JPEG Android via Java conversion. Programmers can use this example code to export PDF to JPEG

Convert PDF to JPEG in Android via Java

How to convert PDF to JPEG? You can easily convert programmatically a document from PDF to JPEG format using Android via Java. Use just a few lines of Android via Java code to convert files with high quality. The Aspose.PDF library will allow any developer to efficiently solve the tasks of converting PDF to JPEG using Android via Java.

For a more detailed description of the code snippet and other possible conversion formats, see the Documentation pages. Also, you can check the other conversions of formats, which are supported by our library.

In order to convert PDF to JPEG, we’ll use Aspose.PDF for Android via Java API which is a feature-rich, powerful, and easy-to-use conversion API for Android via Java platform. Check the details of Installing the Library on the Documentation pages. To verify the benefits of the library, try using the conversion PDF to JPEG code snippet. To install and use Aspose.PDF for Android via Java extract files from the ZIP archive.

How to Convert PDF to JPEG


Android via Java developers can easily load & convert PDF files to JPEG in just a few lines of code.

  1. Select a PDF file for converting
  2. Create an object of the Document class, to get the particular page you want to convert
  3. Call the process(..) method to convert the page to JPEG
  4. Save the JPEG file

Here is an example that demonstrates how to convert PDF to JPEG in Android via Java. You can follow these easy steps to convert your PDF file to JPEG format. First, upload your PDF file and then simply save it as a JPEG file. You can use fully qualified filenames for both PDF reading and JPEG writing. The output JPEG content and formatting will be identical to the original PDF document.

Example: Convert PDF to JPEG via Android via Java

This sample code shows PDF to JPEG Android via Java Conversion

Input file:

File not added

Output format:

JPEG

Output file:

    public void convertPDFtoJPEG() {
        try {
            document = new Document(inputStream);
        } catch (Exception e) {
            resultMessage.setText(e.getMessage());
            return;
        }
        File file = new File(fileStorage, "PDF-to-JPEG.jpeg");
        // Create stream object to save the output image
        try {
            OutputStream imageStream =
                    new FileOutputStream(file.toString());

            // Create Resolution object
            Resolution resolution = new Resolution(300);

            // Create JpegDevice object with particular resolution
            JpegDevice JpegDevice = new JpegDevice(resolution);

            // Convert a particular page and save the image to stream
            JpegDevice.process(document.getPages().get_Item(1), imageStream);

            // Close the stream
            imageStream.close();

            resultMessage.setText(file.toString());
        } catch (IOException e) {
            resultMessage.setText(e.getMessage());
        }
    }

Convert PDF to JPEG using Android via Java

Aspose.PDF for Android via Java is a PDF processing API that allows Android apps to read, write, manipulate, and render PDF documents. It has a simple and easy-to-use API for developers. With Aspose.PDF for Android via Java, you can easily convert text and images, and convert PDF to various document formats with high performance and quality. You can also use the Aspose.PDF converter app to check the quality of conversions and view the results online.

You can find more information about Aspose.PDF for Android via Java API on documentation and examples on how to use API