The EPUBs are much more convenient for the reading experience and it makes the readability of the material much more optimal. Since EPUB design is based on HTML, so ePubs can automatically fix content layout and work well with any screen size. On the other hand, PDFs are universal format and supported on all platforms. Furthermore, PDFs are also known as the format for printing high graphics. In this article, we are going to discuss the conversion of EPUB to PDF using Cloud API.
EPUB to PDF Conversion API
Aspose.PDF Cloud is an amazing API offering the features to create, digitally sign, split, merge, & convert PDF files stored on the cloud. In this article, we are going to use Aspose.PDF Cloud SDK for .NET which enables you to implement PDF processing features in .NET applications. It also enables us to convert eBook to PDF online.
Now in order to get started, the first step is installation, and it’s available for download over NuGet and GitHub. Please execute the following command in the terminal to install the SDK via NuGet:
nuget install Aspose.Pdf-Cloud
Or execute the following command in NuGet Package Manager:
PM> Install-Package Aspose.Pdf-Cloud
Now we need to create a free subscription account by visiting Aspose.Cloud dashboard. Sign Up using GitHub or Google account, or click create a new Account button. Fro8m the Cloud dashboard, obtain your personal Client Credentials.
EPUB to PDF in C#
Please follow the steps given below to transform the EPUB to PDF using the C# .NET code snippet.
- First of all, create a PdfApi instance while passing Client ID and Client Secret details as arguments
- Secondly, call the PutEpubInStorageToPdf(..) method of PdfApi class which takes the output PDF name and input EPUB as arguments. The resultant file is stored in cloud storage
- Finally, once the conversion is successful, print the success message in the console
You may consider downloading the files used in the above example from Sway.epub and Converted.pdf.
Convert eBook to PDF using cURL Commands
Owing to the REST architecture of the API, it can also be accessed using cURL commands through the command line terminal. Now as a first step, please execute the following command to generate a JSON Web Token (JWT) based on ClientID and ClientSecret details.
curl -v "https://api.aspose.cloud/connect/token" \ -X POST \ -d "grant_type=client_credentials&client_id=4ccf1790-accc-41e9-8d18-a78dbb2ed1aa&client_secret=caac6e3d4a4724b2feb53f4e460eade3" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Accept: application/json"
Once we have the JWT token, we can perform the conversion using the following command.
curl -X PUT "https://api.aspose.cloud/v3.0/pdf/Converted.pdf/create/epub?srcPath=Sway.epub" \ -H "accept: application/json" \ -H "authorization: Bearer <JWT Token>"
In this article, we have discussed an amazing feature of converting EPUB to PDF format. You may consider evaluating the API through the Swagger interface in your web browser. Furthermore, our SDKs are developed under MIT License, so their complete code snippet can be downloaded from GitHub.
In case you encounter any issues while using the API or you have any related queries, please feel free to contact us via the Free Support forum.
We recommend visiting the following links to learn more about