Epublib


Source link: https://github.com/psiegman/epublib

epublib

Epublib is a java library for reading/writing/manipulating epub files.

I consists of 2 parts: a core that reads/writes epub and a collection of tools. The tools contain an epub cleanup tool, a tool to create epubs from html files, a tool to create an epub from an uncompress html file. It also contains a swing-based epub viewer.

The core runs both on android and a standard java environment. The tools run only on a standard java environment.

This means that reading/writing epub files works on Android.

Command line examples

Set the author of an existing epub java -jar epublib-3.0-SNAPSHOT.one-jar.jar --in input.epub --out result.epub --author Tester,Joe

Set the cover image of an existing epub java -jar epublib-3.0-SNAPSHOT.one-jar.jar --in input.epub --out result.epub --cover-image my_cover.jpg

Creating an epub programmatically

package nl.siegmann.epublib.examples;  import java.io.InputStream; import java.io.FileOutputStream;
import nl.siegmann.epublib.domain.Author; import nl.siegmann.epublib.domain.Book; import nl.siegmann.epublib.domain.Metadata; import nl.siegmann.epublib.domain.Resource; import nl.siegmann.epublib.domain.TOCReference;  import nl.siegmann.epublib.epub.EpubWriter;
public class Translator {

private static InputStream getResource( String path ) {

  return Translator.class.getResourceAsStream( path );

}

 private static Resource getResource( String path, String href ) {

  return new Resource( getResource( path ), href );

}

 public static void main(String[] args) {

  try {

 // Create new Book

 Book book = new Book();

 Metadata metadata = book.getMetadata();

// Set the title

 metadata.addTitle("Epublib test book 1");

// Add an Author

 metadata.addAuthor(new Author("Joe", "Tester"));

// Set cover image

 book.setCoverImage(

getResource("/book1/test_cover.png", "cover.png") );

// Add Chapter 1

 book.addSection("Introduction",

getResource("/book1/chapter1.html", "chapter1.html") );

// Add css file

 book.getResources().add(

getResource("/book1/book1.css", "book1.css") );

// Add Chapter 2

 TOCReference chapter2 = book.addSection( "Second Chapter",

getResource("/book1/chapter2.html", "chapter2.html") );

// Add image used by Chapter 2

 book.getResources().add(

getResource("/book1/flowers_320x240.jpg", "flowers.jpg"));

// Add Chapter2, Section 1

 book.addSection(chapter2, "Chapter 2, section 1",

getResource("/book1/chapter2_1.html", "chapter2_1.html"));

// Add Chapter 3

 book.addSection("Conclusion",

getResource("/book1/chapter3.html", "chapter3.html"));

// Create EpubWriter

 EpubWriter epubWriter = new EpubWriter();

// Write the Book as Epub

 epubWriter.write(book, new FileOutputStream("test1_book1.epub"));

  
}
 catch (Exception e) {

 e.printStackTrace();

  
}

}
 
}
 

Resources

GoogleMapsRippleEffect is an awesome android library to show multiple types of circular ripple effects on google map.

Most powerful wave load view, you can custom any style by yourself.

An avatar ImageView with any kind of shapes.

A demo project which has FlowLayout to work with tags.

A lot of utility classes for Android development.

A Java fluent assertion wrapper to improve readability of RxJava's TestSubscriber assertions.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes