pdf to epub

Convert PDF to EPUB Online

A PDF displays the exact same content and layout no matter which operating system, device, or software application is used. It’s easy to share or receive PDFs without compromising the quality but, you need specialized programs to edit them. However, if we convert PDF to EPUB format, it’s relatively easy to modify the files. It’s supported on multiple reader platforms and offers more security than PDF.

PDF to EPUB Conversion API

Aspose.PDF Cloud SDK for Python provides PDF creation, manipulation, and conversion capabilities. Now in order to use the SDK, the first step is its installation as its freely available for download over PIP and GitHub repository. So, simply execute the following command on the terminal/command prompt to install the latest version of SDK on the system.

pip install asposepdfcloud

Now the next important step is the creation of a free subscription account over Aspose.Cloud dashboard. Use your GitHub or Google account to Sign Up or, simply click the Create a new Account button. Obtain your personalized Client Credentials as they will be used in subsequent sections.

Convert PDF to EPUB using Python

Please follow the steps given below to load PDF files stored on cloud storage and perform conversion to EPUB format.

  • Firstly, create an instance of ApiClient while passing client credentials as arguments
  • Secondly, initialize PdfApi by passing the ApiClient object as arguments
  • Thirdly, set value for optional parameter contentRecognitionMode to control content recognition. Value can be Fixed, PdfFlow, or Flow.
  • Finally, call the put_pdf_in_storage_to_epub(..) method to load the PDF file already available in cloud storage, convert it to EPUB format and save the resultant file in the same storage.
PDF to EPUB preview

Image 1:- PDF to EPUB conversion preview.

The input PDF file used in the above example can be downloaded from marketing.pdf.

PDF to EPUB using cURL Commands

All REST APIs can be accessed via cURL commands and in this section, we are going to use the cURL commands for PDF to open standards for eBooks. However, as our APIs are only accessible to authorized customers, so we need to generate a JSON Web Token (JWT) based on your client credential details specified over Aspose.Cloud dashboard. Please execute the following command to generate the JWT token.

curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=88d1cda8-b12c-4a80-b1ad-c85ac483c5c5&client_secret=406b404b2df649611e508bbcfcd2a77f" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"

Now that we have generated the JWT token, please execute the following command to perform the conversion and save the resultant file to cloud storage.

curl -X PUT "https://api.aspose.cloud/v3.0/pdf/marketing.pdf/convert/epub?outPath=Converted.epub&contentRecognitionMode=Fixed" \
-H  "accept: application/json" \
-H  "authorization: Bearer <JWT Token>" -v  \
-d{}

Quick Tip

In order to view the EPUB files, please try using our free EPUB viewer App.

Conclusion

In this article, we have explored the options on how to develop a PDF to EPUB converter using Python. Furthermore, we have also learned about the details of converting PDF to eBook using cURL commands. For your convenience, the complete source code is available over GitHub. In case you encounter any issues or you have any further queries, you may also contact us via the free customer support forum.

We recommend visiting the following articles to learn about: