Answer the question
In order to leave comments, you need to log in
OSError: cannot load library 'gobject-2.0': error 0x7e Export to PDF?
I installed the weasyprint package according to the instructions (Django project) https://simpleisbetterthancomplex.com/tutorial/201...
The error is:
OSError at /tyforindividuals/newty
cannot load library 'gobject-2.0-0': error 0x7e. Additionally, ctypes.util.find_library() did not manage to locate a library called 'gobject-2.0-0'
from django.core.files.storage import FileSystemStorage
from django.http import HttpResponse
from django.template.loader import render_to_string
from weasyprint import HTML
def html_to_pdf_view(request):
par = ['a', 'b', 'c']
html_string = render_to_string('my.html', {par})
html = HTML(string=html_string)
html.write_pdf(target='/tmp/mypdf.pdf')
fs = FileSystemStorage('/tmp')
with fs.open('mypdf.pdf') as pdf:
response = HttpResponse(pdf, content_type='application/pdf')
response['Content-Disposition'] = 'attachment; filename="mypdf.pdf"'
return response
Answer the question
In order to leave comments, you need to log in
First link on google: https://stackoverflow.com/questions/69067530/how-t...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question