Git Product home page Git Product logo

agusmakmun / welut Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 10.0 13.08 MB

:wavy_dash: welut is django plugin to convert the .epub, .mobi or .pdf files as images. Usefull to manage e-library or e-commerce bassed on e-book system.

License: MIT License

Shell 0.81% Python 81.36% HTML 17.83%
welut e-library paperless django django-plugin epub-converter mobi-converter pdf-converter ebook-converter e-book

welut's Introduction

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

welut's People

Contributors

agusmakmun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

welut's Issues

Converting a pdf file to epub format

Hi,
I came across this library while searching for it on the web. I have a requirement of converting a pdf file to epub format. Is that something which is possible using this library. Do you have any examples of doing so ?

get/write a message

having a problem when I want to get/write a message from tasks process of conversion.

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.