Code Monkey home page Code Monkey logo

kindle-helper's Introduction

kindle-helper

English

项目介绍

kindle-helper是一个Java依赖包,它可以帮助我们快捷的生成包含封面、目录的 .mobi 电子书。

软件环境

  • JDK1.8+
  • Maven3.0+

实现原理

kindle-helper通过一系列模板文件构建出生成书籍的 .opf 等文件,之后调用kindleGen生成 .mobi 文件。

运行须知

因打包大小问题,依赖包中未包含kindleGen,因此运行前请将kindleGen放置在jar包同级目录的/bin下,也可自定义外部kindleGen目录,请通过kindlegenPath构建MobiWriter。

kindleGen官方下载

使用说明

构建Book,并填充书籍章节chapters,之后调用对应的文件生成器即可。

生成.mobi

创建MobiWriter传入Book生成 .mobi,若要附带封面图片,请调用coverUrl参数的MobiWriter构造器,目前仅支持远程图片。

生成.txt

创建TxtWriter传入Book生成 .txt

运行截图

demo

代码示例

Book book = new Book();
ChapterInfo chapterInfo = new ChapterInfo();
//...赋值Book和chapterInfo
book.setChapters(new ChapterInfo[]{chapterInfo});
Writer writer = new MobiWriter();
writer.generate(book, "D:\\tmp3");

详情见Main.java

Maven临时仓库

在pom文件project元素的下一层增加如下配置:

<repositories>
    <repository>
        <id>mvnrepo</id>
        <name>mvn repository</name>
        <url>https://gitee.com/hf-hf/mvnrepo/blob/master</url>
    </repository>
</repositories>

之后添加kindle-helper依赖:

<dependency>
    <groupId>top.hunfan</groupId>
    <artifactId>kindle-helper</artifactId>
    <version>0.0.4</version>
</dependency>

kindle-helper's People

Contributors

hf-hf avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.