I have an android epub reader project which uses Readium SDK for opening epub files. I'm trying user to open pdf files to which I want to convert to epub, store it to internal storage and make it available for user to read through my epub reader application. Now I've searched for libraries and projects and found some but didn't meet my expectation.

Following are the resources I've tried:

Java PDF converter library

An opensource android project

I'm yet to try this LeadTools SDK which was suggested by this answer:

Leadtools SDK

Can anyone recommend me any libraries or resources regarding this?

  • Have you considered opening the PDF directly in your reader project? Android has had PDF viewing support for some time now. If not, and you really need PDF2EPUB, are you looking to convert the PDF to reflowable HTML or fixed layout HTML?
    – Ryan
    Commented Sep 9, 2020 at 5:43
  • @Ryan My project is a epub reader project. That's why I need to convert. This is the requirement. As it will have to be epub so it's reflowable HTML
    – miq0717
    Commented Sep 13, 2020 at 6:44
  • "will have to be epub so it's reflowable HTML" Just so you know, EPUB supports fixed HTML layout, so you can do either in EPUB.
    – Ryan
    Commented Sep 14, 2020 at 16:52
  • "found some but didn't meet my expectation." What issues did you have with the 3 tools you listed in your question?
    – Ryan
    Commented Sep 14, 2020 at 16:53
  • @Ryan I'm now working with the second one. It seems to have working. Just an issue there. Bengali text extraction doesn't seem to work correctly. And that's an iText issue.
    – miq0717
    Commented Sep 15, 2020 at 4:39

1 Answer 1


I've noticed one of the resources you listed is the LEADTOOLS SDK. (Disclosure: I'm a LEADTOOLS employee).

Converting to the ePub file format from an input PDF can be done through the use of the DocumentConverter as you have listed https://www.leadtools.com/help/sdk/v21/dh/doxc/documentconverter.html

To test this in Android code, you can try the following:

Uri imageUri = data.getData();
ILeadStream stream = LeadStreamFactory.create(getContentResolver().openInputStream(imageUri),true);
DocumentConverter convert = new DocumentConverter();
ocrEngine = OcrEngineManager.createEngine(OcrEngineType.LEAD);
ocrEngine.startup(null, null, null, OCR_RUNTIME_DIRECTORY);
convert.setOcrEngineInstance(ocrEngine, true);
convert.setDocumentWriterInstance(new DocumentWriter());

File file = new File(this.getFilesDir(), "output.epub");
String path = file.getAbsolutePath();

LEADDocument inputstream = DocumentFactory.loadFromStream(stream, new LoadDocumentOptions());
DocumentConverterJobData jobData = new DocumentConverterJobData();

DocumentConverterJob job = convert.getJobs().createJob(jobData);

Assuming you are passing in a PDF file which is populated through imageUri, this will work. If you would like a starting template to work with, you can try supplying this code inside this template: https://www.leadtools.com/help/sdk/v21/tutorials/viewers/cross-platform/android/display-images-in-an-image-viewer.html

  • I have to convert Bengali language PDFs which are encoded in Unicode. Will this work in that case?
    – miq0717
    Commented Dec 10, 2020 at 4:55
  • You will be able to convert your Bengali language PDFs to ePub as long as the original PDF file you are supplying is already searchable. Both PDF and ePub are both Document File Formats Commented Dec 15, 2020 at 17:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.