Giter Club home page Giter Club logo

preprocesstext's Introduction

整个过程学习自:制作Kindle mobi书籍完美教程

txt转mobi

  • 用来将粗txt文件转成带目录,有一点格式的mobi文件。需要用到Calibre软件
  • 首先使用PreprocessText文件夹中的java代码对txt文件进行预处理,它做的工作有:删除段前空格并用两个全角空格代替、对章和卷名用markdown标记
  • 然后使用Calibre软件进行转换,需要用到的CSS文件在下面附上了

txt文件预处理

  • PreprocessText包中包含三个java文件,提供一个具有简单UI的小工具对txt文件进行预处理
  • txt文件最好是utf-8格式的
  • 用java读取utf-8格式的时候会产生乱码,所以用到了UnicodeReader.java文件进行乱码的处理

calibre处理

这个软件比较简单好用,要注意的就是添加如下CSS样式

MyCSS:


body { margin: 0; }
p {margin-top: 0pt; margin-bottom: 0pt; padding: 0pt; text-indent: 15pt; text-align: justify;}
h1 { text-align: center; padding-top: 350px; page-break-before: always;}
h2 {text-align: center; font-weight: 700; font-size: xx-large; padding-top: 12pt; padding-bottom: 20pt; page-break-before: always;}

http://amalthia.mediawood.net/tutorials/ebooks/look.html

TXT2MOBI

  • This is a program to convert .txt to .mobi,and Calibre is recommended.
  • First,use java to preprocessing the text files,including deleting spaces and replace them with full-width spaces, add markdown identifies to vol and chapter names.
  • Then use Calibre to convert,the CSS is attached below.

txt pre-processing

  • Package PreprocessText includes three java files which provide a tool to pre-processing txt files.
  • And txt files are recommended to be saved as utf-8.
  • Use UnicodeReader.java to solve the messy code while reading file in java.
  • Simple UI.

calibre

MyCSS:


body { margin: 0; }
p {margin-top: 0pt; margin-bottom: 0pt; padding: 0pt; text-indent: 15pt; text-align: justify;}
h1 { text-align: center; padding-top: 350px; page-break-before: always;}
h2 {text-align: center; font-weight: 700; font-size: xx-large; padding-top: 350px; padding-bottom: 20pt; page-break-before: always;}

http://amalthia.mediawood.net/tutorials/ebooks/look.html

preprocesstext's People

Contributors

freshma avatar

Watchers

 avatar  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.