Some test text!

Discord Logo

Chat with us

PDFTron is now Apryse, learn more here.

Android / Guides / PDF to MS Office

Platform


PDFTron is now Apryse, learn more here.

Convert PDF to MS Office in Android

Internet connection is required for this feature.
Additional easyPDF Cloud REST API plan required.

The PDF to Office conversion API uses easyPDF Cloud REST API and allows conversion from PDF to Office (Word, PowerPoint and Excel).

Integration

Integrate actions package with Gradle

  1. Integrate Apryse core and the tools library as described here .

  2. In your app module's build.gradle file (usually app/build.gradle), add the dependency for Apryse's actions package:

    dependencies {
        implementation "com.pdftron:actions:9.5.0"
    }

Integrate actions package manually

  1. Integrate Apryse core and tools packages as described here .

  2. Copy pdftron-actions.aar directly into your app module's libs directory. You will see other Apryse AARs here such as pdftron.aar and tools.aar

  3. In your app module's build.gradle file (usually app/build.gradle), add a dependency to Apryse actions package:

    dependencies {
        implementation "com.pdftron:actions@aar"
    
        implementation "com.squareup.okhttp3:okhttp:3.12.8"
    }

Initialize

First, initialize EasyPdfService:

// Client ID. You can get your client ID from the developer page
// (for registered user, you must sign in before visiting this page)
// https://www.easypdfcloud.com/developer
//
// To test the sample code quickly for demo purpose, you can use
// the following demo client ID:
//
//   05ee808265f24c66b2b8e31d90c31ab1
//
private final String clientId = "05ee808265f24c66b2b8e31d90c31ab1";

// Client secret. You can get your client secret from the developer page
// (for registered user, you must sign in before visiting this page)
// https://www.easypdfcloud.com/developer
//
// To test the sample code quickly for demo purpose, you can use
// the following demo client secret:
//
//   16ABE87E052059F147BB2A491944BF7EA7876D0F843DED105CBA094C887CBC99
//
private final String clientSecret = "16ABE87E052059F147BB2A491944BF7EA7876D0F843DED105CBA094C887CBC99";

EasyPdfService.initialize(clientId, clientSecret);

Convert

Then perform the conversion:

String taskTypeWord = "EPWF_CONVERTER_CONVERT_TO_WORD"
String taskTypePPT = "EPWF_CONVERTER_CONVERT_TO_POWERPOINT"
String taskTypeExcel = "EPWF_CONVERTER_CONVERT_TO_EXCEL"
String taskRevision = 2

private String export(File inputFile, File ouputFolder, String outputName) {
    return EasyPdfService.startDynamicJob(
        taskTypeWord, // taskTypePPT for PowerPoint and taskTypeExcel for Excel
        taskRevision,
        inputFile,
        ouputFolder,
        outputName
    );
}

Get the answers you need: Support