Skip to content

Instantly share code, notes, and snippets.

@aspose-com-kb
Last active November 24, 2024 14:40
Convert Word DOC to EPUB using Java. For further details: https://kb.aspose.com/words/java/convert-word-doc-to-epub-using-java/
import com.aspose.words.*;
import java.awt.*;
public class Main
{
public static void main(String[] args) throws Exception // Convert DOCX to EPUB in Java
{
new License().setLicense("License.lic"); //To avoid watermark
Document wordDoc = new Document("SampleFile.docx");
HtmlSaveOptions optionsForEpub = new HtmlSaveOptions();
optionsForEpub.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);
optionsForEpub.setSaveFormat(SaveFormat.EPUB);
wordDoc.save("output.epub", optionsForEpub);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment