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

bookracy-convertor

v1.2.4

Published

A tool to convert EPUB files to PDF using jsPDF

Readme

Bookracy Convertor

A powerful EPUB to PDF converter that processes EPUB files and converts them into high-quality, readable PDFs using jsPDF. This package is especially useful for anyone looking to convert EPUB files programmatically within their JavaScript/TypeScript projects.

Features

  • Converts EPUB files to PDF format.
  • Handles images, styles, and text formatting.
  • Preserves the Table of Contents without splitting across pages.
  • Lightweight and fast, built on modern JavaScript libraries (jsPDF, JSZip, html-to-text).

Installation

To use this package, you need to install it via npm:

npm install bookracy-convertor

Usage

You can import the buildPDFConvertor function and pass the URL of the EPUB file along with a button element. The PDF will be generated when the button is clicked.

Example:

import { buildPDFConvertor } from 'bookracy-convertor';

// Get the button and the EPUB URL
const button = document.getElementById('generate-pdf');
const bookUrl = 'https://example.com/path/to/book.epub';

// Initialize the convertor
buildPDFConvertor(bookUrl, button);

Parameters

  • bookUrl (string): The URL of the EPUB file to convert.
  • button (HTMLElement): The button element that will trigger the conversion on click.

When the button is clicked, the PDF will be generated and automatically downloaded.

Requirements

  • Node.js v14 or later.
  • Browser environment with DOM manipulation (works with most modern browsers).

Testing the Project

Development Setup

First, clone the repository and install dependencies:

git clone https://github.com/yourusername/bookracy-convertor.git
cd bookracy-convertor
npm install

Run in Development Mode

npm run dev

This will start a Vite development server to preview and test your changes.

Build for Production

npm run build

This will compile and bundle the code for production use.

Run ESLint

Make sure to keep the code linted and formatted:

npm run lint
npm run lint:fix  # Automatically fix issues

Testing

You can test the conversion function by simulating the button click event in a browser.

  1. Start the development server using npm run dev.
  2. Access the browser and test the button that triggers the conversion.
  3. You can also test individual parts by inspecting logs, such as EPUB fetching, PDF generation, etc.

For formal tests (unit tests, etc.), Jest or Mocha can be integrated into the project. (Note: Tests are not included in this version but can be added in the future.)

Contributing

We welcome contributions! Please read the CONTRIBUTING.md file for more details on how to contribute to this project.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Feedback and Support

Feel free to open issues on the GitHub repository or submit pull requests for improvements.

Reporting Bugs

If you find a bug in the project, please open an issue with a detailed description of the problem and steps to reproduce it. Make sure to mention the platform and environment you’re using (e.g., operating system, Node.js version, browser, etc.).

Feature Requests

If you have a feature idea, please and describe the feature in detail. We’re always open to new suggestions and ideas.

Code of Conduct

Please respect others and be kind in your contributions. Harassment or rude behavior will not be tolerated. Let’s make this project a great space for collaboration! 😊

Thank you for contributing!


How to Test

In addition to the usage and contribution guidelines, here are more detailed testing steps for the project:

1. Manual Testing in the Browser

  • Start Development Server:
    npm run dev
  • Access the browser, trigger the conversion by clicking the button, and observe the PDF download.

2. Check Console Logs:

  • Add console.log statements to verify that key processes (e.g., fetching the EPUB, generating PDF pages, handling styles) are working as expected.

3. Automated Testing (Future Enhancement):

  • You can integrate testing frameworks like Jest or Mocha for unit tests on functions such as fetchFile, handleEpub, or the PDF creation logic.
  • Add tests to ensure functions behave correctly for different EPUB files (e.g., with or without Table of Contents, with different image formats, etc.).