Electronic Publication (ePub) is an Open eBook file format and is supported by many e-readers, and compatible software is available for most smartphones, tablets, and computers. Since EPUB files are structured like ZIP files, you can rename an EPUB eBook, replacing .epub with .zip, and then open the file with your favorite file compression program, like the free 7-Zip tool. Inside you should find the contents of the EPUB eBook in HTML format, as well as the images and styles used to create the EPUB file. The EPUB file format supports embedding files such as GIF, PNG, JPG, and SVG images.
Please note that this freely available eBook standard supports more hardware eBook readers than any other file format. Therefore, the EPUB files can be opened in most eBook readers, including the B&N Nook, Kobo eReader, and Apple’s Books app. But in case you need to share this document with users who may or may not have specific software installed, it reduces the chances of users to easily view these documents. So a viable solution is to convert EPUB to PDF format.
- EPUB to PDF Conversion API
- EPUB to PDF conversion using cURL command
- Convert EPUB to PDF in C#
EPUB to PDF Conversion API
Aspose.PDF Cloud is an amazing REST API offering the capabilities to create as well as manipulate PDF formats. It also enables the users to convert various file formats to PDF format over the Cloud. No software download or installation required. Perform all PDF file processing operations in the cloud. Albeit the users can access REST APIs to perform all processing, we have created Cloud SDKs in various programming languages that are wrappers around REST API. So you can quickly and easily process documents in the language of your choice while gaining all benefits of strong types and IDE highlights.
In this article, we are going to discuss the EPUB to PDF conversion operation using Aspose.PDF Cloud SDK for .NET. So in order to use the SDK, the first step is to install it over the system. The SDK is available for download at NuGet and GitHub. Please execute the following command in the NuGet package manager to perform the installation:
Install-Package Aspose.Pdf-Cloud -Version 20.12.0
In case you eliminate the version details, the latest version will be automatically pulled. After the installation, the next step is to create an account by visiting Aspose.Cloud dashboard. If you have GitHub or Google account, simply Sign Up. Otherwise, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.
EPUB to PDF conversion using cURL command
Owing to the REST API architecture of APIs, you can access them via cURL commands without any hassle. And the next step is to generate a JSON Web Token (JWT) based on your ClientID and ClientSecret details retrieved from Aspose.Cloud dashboard. Please execute the following command in the terminal to generate the JWT token.
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=718e4235-8866-4ebe-bff4-f5a14a4b6466&client_secret=388e864b819d8b067a8b1cb625a2ea8e" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Now we need to call the GetEpubInStorageToPdf API to perform the conversion operation. Please note that this method expects the source .EPUB file to be available in Cloud storage.
curl -X GET "https://api.aspose.cloud/v3.0/pdf/create/epub?srcPath=Alices_Adventures_in_Wonderland.epub" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
Convert EPUB to PDF in C#
In order to perform the conversion using C# .NET, please follow the instructions specified below.
- Firstly, create an instance of PdfApi class while providing Client ID and Client Secret as arguments.
- Secondly, specify the input EPUB file and resultant file names.
- Thirdly, call PutEpubInStorageToPdf(…) method of PdfApi class while passing resultant PDF and input EPUB name as arguments.
The sample files used in above example can be downloaded from following links.
In this article, we have discussed the capabilities of Aspose.PDF Cloud SDK for .NET pertinent to the conversion of EPUB file to PDF format. Its evident that with few code lines, this conversion operation can be performed and then you can share the output file with users on any platform. Please note that all our Cloud SDKs are opensource and their complete source code is available on GitHub. Apart from using the cURL commands and C# .NET code, you may also explore the features of API through swagger interface.
In case you encounter any issue while using the API or you need any further information, please feel free to contact via Free customer support forum.
We recommend visiting the following links for information on: