This article explains the process to convert EPUB to PDF using C# REST API. You will get details to develop an EPUB to PDF converter using C# Low Code API by utilizing a Dotnet-based Cloud SDK. All the necessary parameters are discovered to customize the output PDF file.
Prerequisite
- Create an account and get API credentials for generating a PDF from an EPUB file
- Download Aspose.HTML Cloud SDK for Dotnet to transform an EPUB file to a PDF file
- Set up a C# project with the above SDK
Steps to Convert EPUB File to PDF using C# Low Code API
- Include Sdk and Sdk.Conversion namespace from the Aspose.HTML.Cloud library
- Create an HtmlApi object with your Client ID and Secret
- Get the .ConvertApi property of the HtmlApi instance for the conversion features
- Instantiate a PDFConversionOptions object to define output file parameters
- Specify the height and width of the PDF in units
- Set the left, right, top, and bottom margins to 1 unit each
- Call the ConvertAsync method with the input EPUB filename, the desired output PDF filename, and the configured options
These steps describe the process transform an EPUB to PDF using C# REST API. Import required namespaces, create the API instance, get the ConvertApi property, and instantiate the PDFConversionOptions for customizing the output PDF. Finally, call the ConvertAsync() method to perform the conversion.
Code for Software to Convert EPUB to PDF using C# .NET-based API
The above-mentioned code demonstrates the transformation of a file from EPUB to PDF using C# RESTful Service. It allows setting the height/width of the output PDF page and page margins for left, right, bottom, and top. You can perform various types of conversions using the ConvertAsync() method.
This article has taught us how to develop an EPUB to PDF converter software using C# .NET-based API. To convert an EPUB file to a DOCX file, refer to the article on Convert EPUB to DOCX using C# REST API.