aspose-pdf / Aspose.PDF-for-Android-via-java

Aspose.PDF for Android via Java Examples
https://products.aspose.com/pdf/android-java
MIT License
20 stars 12 forks source link

Not converting PDF to HTML also file not saved on specified location #8

Open cupatil opened 2 years ago

cupatil commented 2 years ago

We are evaluating Android aspose pdf library and trying to convert pdf to html but the file is not generating.

We are using below code for the same:

InputStream i = null;
try {
    i = this.context.getApplicationContext().getContentResolver().openInputStream(uris[0]);
    Document d = new Document(i);
    App.closeStream(i);

    File output = new File(context.getFilesDir(), "html/Aspose_DocToHTML.html");
    d.save(output.toString(), SaveFormat.);

    return output.toString();
} catch (Exception x) {
    this.error = x;
} finally {
    App.closeStream(i);
}

To apply license, Using below code in application class

License license = new License();
InputStream i = null;
try {
    i = getResources().getAssets().open(getString(R.string.aspose_pdf_license_asset_file));
    license.setLicense(i);
    closeStream(i);
} catch (Exception x) {
    Log.e(App.class.getName(), Log.getStackTraceString(x));
} finally {
    closeStream(i);
}

Added below lib in gradle:

compile (
group: 'com.aspose',
name: 'aspose-pdf',
version: '20.11',
classifier: 'android.via.java')

Please suggest, We have did same thing to Aspose word library there it work properly also saving the html file. but here we are not getting any error also not generating/saving html file. We have also cross checked the write external storage permission for the same.