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

PDF Downloads #29

Open
TheOnlyWayUp opened this issue Dec 6, 2024 · 3 comments
Open

PDF Downloads #29

TheOnlyWayUp opened this issue Dec 6, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@TheOnlyWayUp
Copy link
Owner

PDF Downloads would be great.

References:

This feature will be available to donators in December 2024.

Scheduled to release in January 2025, early release is bountied at $50.

Want to support development, and get early-access to features?

@TheOnlyWayUp TheOnlyWayUp added the enhancement New feature or request label Dec 6, 2024
@TheOnlyWayUp TheOnlyWayUp added this to the January 2025 milestone Dec 6, 2024
@TheOnlyWayUp TheOnlyWayUp self-assigned this Dec 6, 2024
@TheOnlyWayUp
Copy link
Owner Author

016ad62 (private) implements PDF Downloads with wkhtmltopdf and pdfkit. It took a lot of time and effort, and it works well.

Unfortunately, wkhtmltopdf is EOL and is riddled with vulnerabilities - it's a great library for rendering trusted HTML, but that's not applicable here. Also, I can't help but feel excited looking at Weasyprint's samples lol - Preview Book.pdf.

Relevant: wkhtmltopdf recommendations

@AaronBenDaniel
Copy link
Collaborator

AaronBenDaniel commented Dec 23, 2024

As of writing this, the Dockerfile in feature/#29-pdf-downloads is broken. The container builds with a missing library that results in the following output when being run.


-----

WeasyPrint could not import some external libraries. Please carefully follow the installation steps before reporting an issue:
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#troubleshooting 

-----

Traceback (most recent call last):
  File "/app/src/main.py", line 18, in <module>
    from create_book import (
  File "/app/src/create_book.py", line 14, in <module>
    from weasyprint import HTML, CSS, default_url_fetcher
  File "/usr/local/lib/python3.10/site-packages/weasyprint/__init__.py", line 425, in <module>
    from .css import preprocess_stylesheet  # noqa: I001, E402
  File "/usr/local/lib/python3.10/site-packages/weasyprint/css/__init__.py", line 28, in <module>
    from .computed_values import COMPUTER_FUNCTIONS
  File "/usr/local/lib/python3.10/site-packages/weasyprint/css/computed_values.py", line 9, in <module>
    from ..text.ffi import FROM_UNITS, ffi, pango
  File "/usr/local/lib/python3.10/site-packages/weasyprint/text/ffi.py", line 447, in <module>
    pango = _dlopen(
  File "/usr/local/lib/python3.10/site-packages/weasyprint/text/ffi.py", line 432, in _dlopen
    return ffi.dlopen(names[0], flags)  # pragma: no cover
  File "/usr/local/lib/python3.10/site-packages/cffi/api.py", line 150, in dlopen
    lib, function_cache = _make_ffi_library(self, name, flags)
  File "/usr/local/lib/python3.10/site-packages/cffi/api.py", line 834, in _make_ffi_library
    backendlib = _load_backend_lib(backend, libname, flags)
  File "/usr/local/lib/python3.10/site-packages/cffi/api.py", line 829, in _load_backend_lib
    raise OSError(msg)
OSError: cannot load library 'libpango-1.0-0': libpango-1.0-0: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called 'libpango-1.0-0'

was not sure if this should be it's own issue or not

@AaronBenDaniel
Copy link
Collaborator

See #33 for proposed fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants