weasyprint

Bootstrap CSS is not applied in weasyprint

萝らか妹 提交于 2020-02-29 07:16:17
问题 I have made a flask application which generates .pdf from html with weasyprint and send it as attachment. But apparently bootstrap 4 css is not applied. I can't find a solution. It is working well with pdfkit but I need weasyprint, since pythonanywhere.com does not support pdfkit. I have tried linking bootstrap, using bootstrap css as file in my html, but there was no difference. This is my python part, which generates and sends pdf. @app.route('/pdf_send', methods=('GET', 'POST')) @login

Bootstrap CSS is not applied in weasyprint

社会主义新天地 提交于 2020-02-29 07:14:32
问题 I have made a flask application which generates .pdf from html with weasyprint and send it as attachment. But apparently bootstrap 4 css is not applied. I can't find a solution. It is working well with pdfkit but I need weasyprint, since pythonanywhere.com does not support pdfkit. I have tried linking bootstrap, using bootstrap css as file in my html, but there was no difference. This is my python part, which generates and sends pdf. @app.route('/pdf_send', methods=('GET', 'POST')) @login

Weasyprint pdf generation, too long, makes the download impossible. How to stream its creation?

狂风中的少年 提交于 2020-01-07 06:43:09
问题 I've been using Weasyprint for pdf generation successfully, until I reach a certain size, a common use case of my app, where the pdf generation takes so long (more than 10s) that it breaks the connectivity with the browser, and the download is impossible. I suppose I must stream the file creation and return a django StreamingHttpResponse (agree ?). I wouldn't pre-process the pdf because it is formed from baskets with items users frequently add or delete. But how can I stream the file creation

Trouble running WeasyPrint after installing El Capitan (OSX 10.11)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-25 12:42:11
问题 I recently updated my OS on my mac to El Capitan and since then have been running into issues trying to run WeasyPrint. I have updated macports, uninstalled and reinstalled all of the macport dependencies. I've also uninstalled and reinstalled WeasyPrint via pip with no issues, but still it doesn't run. I also have the export DYLD_FALLBACK_LIBRARY_PATH="/opt/local/lib" in my ~/.profile which helped solve the import errors and allowed WeasyPrint to run before I had El Capitan installed. When i

WeasyPrint usage with Python 3.x on Windows

左心房为你撑大大i 提交于 2019-12-13 05:14:21
问题 I can't seem to get WeasyPrint to work on Windows with Python 3.4 or 3.5. Has anyone been able to do this? There aren't forums at weasyprint.org and the IRC channel is dead. I've been able to install using both Python 3.4.3 and 3.5.1. I've followed the guideline found here [1]. I've also made note that WeasyPrint's site claims it should work with Python 2.6+ or 3.1+. When I install for Python 3.4.3 and open the Python shell and simply 'import weasyprint' I get this: C:\Python34>python Python

Can't access project absolute url from inside Django Docker instance

余生颓废 提交于 2019-12-11 05:20:06
问题 I have a project started with Cookiecutter Django and I'm currently adding WeasyPrint to serve some views as PDF files. This is working fine on development. Cookiecutter Django is using Caddy as the HTTP server. I'm having errors on production due I can't access to files through its absolute URL from inside the Django docker instance. From inside the Django docker instance, this does not work: $ curl https://myowndomain.com curl: (7) Failed to connect to myowndomain.com port 443: Connection

Internet Public ip address and django static file in pdf

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 04:26:54
问题 I used django and weasyprint to make an application which print a pdf file with picture and css file which design my pdf file. I used nginx, gunicorn and supervisor to deploy my application. In my intranet all is ok. When i used INTERNET PUBLIC IP ADDRESS to publish it on internet, my pdf file don't show anymore picture and css design. but all the application's static files work well I see my gunicorn log but nothing. I use Nginx to serve my static file. this the configuration upstream app

PDF output using Weasyprint not showing images (Django)

旧街凉风 提交于 2019-12-10 15:22:39
问题 I am trying to output PDF on Django using the Weasyprint library, but the images don't appear on the generated PDF. I have tried both relative and static URLs for the images, but even the static URL doesn't show the image. When opening the HTML itself on chrome, the images do show. Here is my pdf generation view in the views.py file: def pdf_generation(request, some_slug) stud = Student.objects.get(some_slug=some_slug) studid = stud.some_slug context = {'studid':studid} html_string = render

Django WeasyPrint CSS integration warning: Relative URI reference without a base URI: <link href=“/static/css/bootstrap.min.css”> at line None

白昼怎懂夜的黑 提交于 2019-12-08 15:21:06
问题 I want to generate reports using WeasyPrint in Django. But I don't know how to integrate the css (specifically the bootstrap css file). I am able to see the generated html. But I get a warning when I add this line to my template- <link href="/static/css/bootstrap.min.css" rel="stylesheet"/> The warning is - Relative URI reference without a base URI: at line None I would like to know how to send the base URI to the template. Any help would be appreciated. 回答1: Answering my own question. Yeah

Getting “OSError: dlopen() failed to load a library: cairo / cairo-2” on Windows

纵然是瞬间 提交于 2019-12-04 03:15:19
问题 I'm getting OSError: dlopen() failed to load a library: cairo / cairo-2 when trying to execute Django after a new install. Using Windows. I'm using Weasyprint, seems to be related to that one, according to the full trace: Unhandled exception in thread started by <function wrapper at 0x03F605B0> Traceback (most recent call last): File "C:\my-venv\lib\site-packages\django\utils\autoreload.py", line 226, in wrapper fn(*args, **kwargs) File "C:\my-venv\lib\site-packages\django\core\management