Skip to main content

Welut is a ebook converter

Requirements

  • ebook-convert: $ sudo apt install calibre - convert epub & mobi to pdf.

  • pdftocairo: $ sudo apt install -y poppler-utils - convert pdf to images

Installation

Welut is available directly from PyPI:

  1. Installing the package.

$ pip install welut
  1. Don’t forget to add 'welut' to your 'INSTALLED_APPS'.

# settings.py
INSTALLED_APPS = [
    ....
    'welut',
]
  1. Doing makemigrations & migrate

./manage.py makemigrations welut
./manage.py migrate welut

Configuration (settings.py)

WELUT_EXTENSIONS = ['.pdf', '.epub', '.mobi']         # support file extensions
WELUT_REMOVED_EXTENSIONS = ['.pdf', '.epub', '.mobi'] # file to remove after uploaded
WELUT_IMAGES_EXTENSION = '.png'                       # format images extension

Usage

You can using ForeignKey or OneToOneField.

from django.db import models
from welut.models import EbookConverter


class EBook(models.Model):
    title = models.CharField(max_length=200)
    ebook_file = models.ForeignKey(EbookConverter, related_name='ebook_file')
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)

    def __str__(self):
        return self.title

    def get_files(self):
        """ return list images of ebook per-page """
        return self.ebook_file.get_files()

Templates

{% for img_url in object.get_files %}
  <img src="{{ MEDIA_URL }}{{ img_url }}">
{% endfor %}

Usage Preview

https://raw.githubusercontent.com/agusmakmun/welut/master/welut_demo/media/welut-demo.png

Metadata

Release files for welut 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for welut 1.0.4
File Size Uploaded Provenance
welut-1.0.4.tar.gz 6.4 kB Without provenance Details

Release files / welut-1.0.4.tar.gz

Download URL welut-1.0.4.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d898b4f5fb6add287ec7e6218e5b5db9808bae7c445423186543315e34603b07
BLAKE2b-256 checksum
How to use checksums
a7a953acc3b6afff989ff1b129552433de59ddd2c7286f02133200a21a3735c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for welut 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page