I am creating an application to convert HTML Pages to an ePub format. I tried converting the file to PDF Since I require Table Of Contents as the first page of the ePub file. I have used Spire PDF and Spire DOC for this purpose. To convert to ePub, I referred many sites and found that we cannot directly convert it to ePub. so I tried converting to doc and then from doc to ePub. Here is the code.
PDF to Word
public void WordCreation()
{
PdfDocument pdfdoc = new PdfDocument();
pdfdoc.LoadFromFile(@"D:\DocFilesConvert\Pdffiles\Merge.pdf");
pdfdoc.SaveToFile(@"D:\DocFilesConvert\DocFiles\FinalMerge.docx", Spire.Pdf.FileFormat.DOCX);
}
Word to ePub
public void GetEpub()
{
Spire.Doc.Document document = new Spire.Doc.Document();
document.LoadFromFile(@"D:\DocFilesConvert\DocFiles\FinalMerge.docx");
document.SaveToFile(@"D:\DocFilesConvert\EPubFiles\Final.epub", Spire.Doc.FileFormat.EPub);
System.Diagnostics.Process.Start(@"D:\DocFilesConvert\EPubFiles\Final.epub");
}
But I am not getting Table of Contents to be Clickable and also I am not getting the desired format. Is there any direct way to convert to ePub directly from PDF?
You can use Aspose.PDF for PDF to EPUB conversion, without installing any third party editor.
Aspose.PDF Cloud SDK for .NET - REST API Solution:
Aspose.PDF for .NET - On Premise API Solution:
I'm developer evangelist at Aspose.