GroupDocs.Merger for Python via .NET allows you to combine multiple EPUB e-book files into a single file programmatically. All content from the source files is preserved in the merged output — no third-party e-reader software required.
Steps to merge EPUB files
Create an instance of the Merger class and pass the path to the first (base) EPUB file.
Call merger.join() with the path to each additional EPUB file to append.
Call merger.save() with the desired output path to write the merged file.
fromgroupdocs.mergerimportMergerdefmerge_epub_documents():# Load the first EPUB file as the merge basewithMerger("./input.epub")asmerger:# Append the second EPUB filemerger.join("./input2.epub")# Save the combined EPUB filemerger.save("./output.epub")if__name__=="__main__":merge_epub_documents()
input.epub is a sample file used in this example. Click here to download it.
input2.epub is a sample file used in this example. Click here to download it.
Load base document: Merger("./input.epub") opens the first EPUB file as the merge base inside a context manager.
Append second document: merger.join("./input2.epub") appends the content of the second file. Call join again for each additional file.
Save result: merger.save("./output.epub") writes the merged EPUB to disk.
About EPUB File Format
Files with the .EPUB extension are an e-book file format that provides a standard for digital publications accepted by publishers and consumers worldwide. The format is supported by many e-readers and software applications. On macOS, the pre-installed Books app can open EPUB files directly. Compatible software is also widely available for smartphones, tablets, and desktop computers.
Merge EPUB Live Demo
GroupDocs.Merger for Python via .NET provides an online EPUB Merger App, which allows you to try it for free and check its quality and accuracy.