EPUB to PDF – Convert EPUB to PDF in C#


The EPUBs are much more convenient if you have devices compatible with the file format. From reading experience, 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. But in order to read this format, an eBook reader is required. On the other hand, PDFs are universal format and even browsers can read them. It is also independent of the platform; therefore the content cannot be changed and it will retain its formats no matter what device or how it was transferred. Furthermore, PDFs are also known as the format for printing high graphics. So if you need something ready for both the digital and the print world, the PDF format suits your need.

In this article, we are going to discuss the following topics pertinent to the conversion of EPUB files to PDF format using Cloud REST API.

PDF processing REST API

Aspose.PDF Cloud is an amazing REST API offering the features to create, digitally sign, split, merge, & convert PDF files stored on the cloud. Owing to its REST architecture, the API can be used in desktop, mobile, hybrid & cloud-based applications. So you can perform the PDF file creation and manipulation without the installation of Adobe or other software. Furthermore, we have created programming language-specific SDKs that are wrappers around REST API, so that you can process documents in the language of your choice. It empowers you to quickly and easily, gain all the benefits of strong types and IDE highlights. In the rest of the article, we are going to further discuss Aspose.PDF Cloud SDK for .NET which enables you to implement PDF processing features in your C# .NET, ASP.NET, and other .NET based applications.


To get started with the SDK, the first step is to install it over the system. It’s available for download over NuGet and GitHub. So 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

Another approach is the installation directly within Visual Studio solution:

  1. Open the Solution Explorer.
  2. Expand the project and Right-click Packages folder within your solution.
  3. Select Manage NuGet Packages… option
  4. Click on the Browse tab and search for “Aspose.Pdf-Cloud“.
  5. Click on the Aspose.Pdf-Cloud package, select the appropriate version in the right-tab and click Add Package button.
Aspose.PDF-Cloud NuGet package
Image 1:- Aspose.PDF Cloud as NuGet package.

Cloud subscription

At Aspose, privacy and data integrity are of utmost importance and in order to use our APIs, you need to first create a free subscription account by visiting Aspose.Cloud dashboard. No credit card or other payment details are required. Furthermore, under a free subscription account, you can perform up to 150 Free document processing requests.

So 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.

Client Credentials
Image 2:- Client Credentials at Aspose.Cloud dashboard.

EPUB to PDF in C#

Please follow the steps given below to transform the EPUB document to PDF format using the C# .NET code snippet.

  • First of all, create PdfApi instance while passing Client ID and Client Secret details as arguments
  • Seconlyd, call the PutEpubInStorageToPdf(..) method of PdfApi class which takes output PDF name and input EPUB as arguments. The resultant file is stored in cloud storage
  • Finally, once the conversion is succesfull, print the success message in console
EPUB to PDF conversion preview
Image 3:- EPUB to PDF conversion preview.

You may consider downloading the files used in above example from Sway.epub and Converted.pdf.

Convert EPUB to PDF using cURL command

Owing to the REST architecture of the API, it can also be accessed using cURL commands through command line terminal. Since our APIs are only accessible to authorized persons, so the first step is to generate a JSON Web Token (JWT) based on 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" \
-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 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>"

Request URL



In this article, we have discussed some amazing features of Aspose.PDF Cloud API, particularly related to the conversion of EPUB file to PDF format. For testing and evaluation purposes, you may also consider accessing the API through Swagger interface within your web browser. Since our Cloud SDKS are developed under MIT License, so their complete code snippet can be downloaded from GitHub. In case you encounter any issue while using the API or you have any related query, please feel free to contact via Free Support forum.

Related articles

We recommend visiting following links to learn more about