npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

epub-fixed-layout

v1.0.0

Published

Convert standard text-based EPUB files into predefined fixed-layout, image-based EPUBs formatted for E-Ink devices.

Downloads

130

Readme

xEPUB

Convert standard text-based EPUB files into predefined fixed-layout, image-based EPUBs formatted for E-Ink devices.


Installation

Install xEPUB globally via npm:

npm install -g epub-fixed-layout

(Note: If you downloaded the source code directly instead of from npm, open your terminal inside the downloaded folder and type npm link instead).


How to Use xEPUB (Examples)

All conversions are done by typing xepub followed by your desired settings in the terminal.

Pro-Tip (Zero-Config Automation): If you are working in a folder that contains exactly one .epub file, you don't even need to type the name! Just type:

xepub

The tool will automatically detect your file and convert it immediately.

Alternatively, you can create an input folder and drop EPUBs in there. Running xepub will always automatically convert the newest one!

1. The Basic Conversion

If you just want to quickly convert a specific book for a standard 800x480 reader:

xepub mybook.epub

Wait a few moments, and the final image-based .epub will be generated in an output/ folder.

2. Convert for other e-ink devices

You can optimize the output specifically for your device's screen and orientation:

xepub mybook.epub --device 
'kindle-paperwhite' --orientation portrait

3. Maximum Space Savings

If your e-ink device has very limited storage space, use maximum compression (this drops color depth dramatically to save 30-50% more space, without making text unreadable):

xepub mybook.epub --preset compact

(Available presets: compact, balanced, quality)

4. Custom Resolutions for Unsupported Devices

If your specific device is not in the presets list, you can bypass the preset system entirely and force its exact pixel dimensions manually:

xepub mybook.epub --width 1440 --height 1080 --orientation landscape

5. Customizing Fonts (Google Fonts & Local Fonts)

By default, xepub will automatically download and apply the "Noto Serif Bengali" Google font. However, you can change this to any other Google Font or completely override it using a local .ttf file.

A) Using a different Google Font:

xepub mybook.epub --font-size 35 --google-font "Noto Sans Bengali"

B) Using a local font file from your computer: (Make sure to provide both the file path and the internal font name)

xepub mybook.epub --font-size 35 --font "./my_fonts/CustomFont.ttf" --font-name "CustomFont"

6. Create a Quick Preview Image

To generate a single-page screenshot to test your visual settings:

xepub mybook.epub --preview --font-size 35 --google-font "Noto Serif Bengali"

This will skip the full conversion process and instantly create a mybook_preview.png image.

7. Preview a Specific Chapter or Page

If you want to test how chapter 4 specifically looks on page 2:

xepub mybook.epub --preview --preview-chapter 4 --preview-page 2

8. Estimate File Size

See exactly how many pages your output EPUB will have, and how large the file will be, before you start the conversion:

xepub mybook.epub --estimate --device boox-poke

Default Configuration File

If you find yourself perfectly tuning your settings, you can create a default.json file in your working folder. xepub will automatically load it.

Example default.json:

{
  "device": "kindle-paperwhite",
  "fontSize": 30,
  "googleFont": "Noto Serif Bengali",
  "preset": "compact",
  "padding": 20
}

Now, simply typing xepub mybook.epub will automatically use all of these settings!


Advanced Options Reference

| Flag | Description | Default | |---|---|---| | --output, -o | Output file path | ./output/<input>_xEPUB.epub | | --device, -d | Device preset (e.g. kindle-paperwhite, xteink-x4) | custom | | --orientation | Force orientation (landscape or portrait) | Device specific | | --preset, -p | Compression (quality, balanced, compact) | compact | | --font, -f | Path to custom .ttf font file | fonts/Kalpurush.ttf | | --google-font | Google Font name | Noto Serif Bengali | | --font-size | Logical font size in pixels | 30 | | --line-height | Line height multiplier | 1.6 | | --padding | Page padding in pixels | 20 | | --list-devices | List available device presets | | | --preview | Generate a single preview page image | | | --preview-chapter <n>| Specify chapter index for preview | 0 | | --preview-page <n> | Specify page index for preview | Middle page | | --estimate | Estimate output file size without converting | |