Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PDF imports #93

Closed
jzohrab opened this issue Dec 30, 2023 · 4 comments
Closed

Support PDF imports #93

jzohrab opened this issue Dec 30, 2023 · 4 comments
Labels
enhancement New feature or request fixed Fixed in develop or master, to be launched.

Comments

@jzohrab
Copy link
Collaborator

jzohrab commented Dec 30, 2023

Lute suuports txt and epub imports, it would be nice to support pdf as well.

For epub imports, a user had to make a new simple library to get around licensing problems, so if using a PDF library, it should be a good license, no real restrictions. The library should have some basic tests.

The changes in the Lute code to support PDF imports would likely be very similar to those for epub imports:

# . ---------------
./requirements.txt:openepub==0.0.6
./pyproject.toml:  "openepub>=0.0.6,<1"
# lute ---------------
lute/book/service.py:def get_epub_content(epub_file_field_data):
lute/book/service.py:    Get the content of the epub as a single string.   .... etc

lute/book/forms.py:                ["txt", "epub"],
lute/book/forms.py:                "Please upload a valid .txt or .epub file.",

lute/book/routes.py:    if ext == ".epub":
lute/book/routes.py:        return service.get_epub_content(filefielddata)

lute/templates/book/create_new.html:      <td>{{ form.textfile.label }} <i>(.txt, .epub)</i></td>

# tests ---------------
tests/acceptance/book.feature:    Scenario: I can import an epub file.
tests/acceptance/book.feature:        Given a Spanish book "Hola" from file Hola.epub
@jzohrab jzohrab added enhancement New feature or request good first issue Good for newcomers labels Dec 30, 2023
@dgc08
Copy link
Contributor

dgc08 commented Jan 4, 2024

PyPDF2 seems like a good library: https://github.com/py-pdf/pypdf

@jzohrab
Copy link
Collaborator Author

jzohrab commented Jan 4, 2024 via email

@dgc08
Copy link
Contributor

dgc08 commented Jan 4, 2024

As I understand it, we just have to include the copyright notice when redistriburing, so I don't think the license would cause problems.

@jzohrab jzohrab added fixed Fixed in develop or master, to be launched. and removed good first issue Good for newcomers labels Jan 10, 2024
@jzohrab
Copy link
Collaborator Author

jzohrab commented Jan 10, 2024

Merged into develop 🎉

@jzohrab jzohrab closed this as completed Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed Fixed in develop or master, to be launched.
Projects
None yet
Development

No branches or pull requests

2 participants