Skip to content

Instantly share code, notes, and snippets.

How to Convert EPUB to PDF using C#. For more information, please follow link: https://kb.conholdate.com/total/net/how-to-convert-epub-to-pdf-using-csharp
using System;
using GroupDocs.Conversion.Options.Convert;
namespace ConvertEpubToPdfUsingCSharp
{
class Program
{
public static void Main(string[] args) // Main function to convert EPUB to PDF using C#
{
// Remove the watermark in output PDF document by adding license
string licensePath = "GroupDocs.Conversion.lic";
GroupDocs.Conversion.License lic = new GroupDocs.Conversion.License();
lic.SetLicense(licensePath);
// Load the source EPUB file for conversion to PDF
var converter = new GroupDocs.Conversion.Converter("sample.epub");
// Set the conversion options for PDF document to customize the output file
PdfConvertOptions options = new PdfConvertOptions();
// Convert and save the EPUB in PDF format
converter.Convert("converted.pdf", options);
Console.WriteLine("Done");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment