Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

275
Views
How to fix function/symbol 'pango_context_set_round_glyph_positions' error

I have deployed a Django project using Apache2, everything is working fine except for weazyprint which creates PDF file for forms. The pdf was working fine in testing and local host.

Now everytime I access the pdf it is showing this error:

FileNotFoundError at /business_plan/businessplan/admin/info/2/pdf/
[Errno 2] No such file or directory: '/home/ahesham/Portfolio/static\\css\\report.css'

I have tried to change the \ and adding it twice but it didn't work here is the views.py

def admin_order_pdf(request, info_id):
    info = get_object_or_404(Info, id=info_id)
    html = render_to_string('businessplan/pdf.html', {'info': info})
    response = HttpResponse(content_type='application/pdf')
    response['Content-Disposition'] = 'filename="order_{}.pdf"'.format(
        Info.id)
    weasyprint.HTML(string=html,base_url=request.build_absolute_uri()).write_pdf(response,
                                           stylesheets=[weasyprint.CSS(settings.STATICFILES_DIRS[0] + '\css\\report.css')], presentational_hints=True)
    return response

The error is comming from this \css\\report.css knowing that the report.css file is in the static folder and all css and js of the deplyed site is working perfectly fine and I tried python manage.py collectstatic did not work.

I am not sure exactly why is the error showing if it is because of ubunto or django views.

Update:

I have tried changing the location to be as following:

stylesheets=[weasyprint.CSS(settings.STATICFILES_DIRS[0] + '/css/report.css')], presentational_hints=True) 

This is the error that appeared

function/symbol 'pango_context_set_round_glyph_positions' not found in library 'libpango-1.0.so.0': /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: pango_context_set_round_glyph_positions

So I have searched for the solution and I tried to download this package:

sudo apt-get install libpango1.0-0

and also tried:

install libpango1.0-dev

but still nothing changed it wouldn't work getting the same error.

I have also tried replacing static directory with static root as the project is deployed buy i got the same error function/symbol 'pango_context_set_round_glyph_positions' the following:

stylesheets=[weasyprint.CSS(settings.STATIC_ROOT + '/css/report.css')]

This is the settings file:

STATIC_URL = '/static/'
#if DEBUG:
#    STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
#else:
#STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static' )]

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

I am using Ubuntu 18.04 LTS Disk - Apache2 Server

My question: What am I doing wrong and how do I fix it?

Please let me know if additional information required to help fix this error.

Any feedback will be highly appreciated if there are other ways to display PDF in Django admin

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Probably Weasyprint was not downloaded properly:

try:

pip install django-weasyprint

source: https://pypi.org/project/django-weasyprint/

over 4 years ago · Santiago Trujillo Report

0

I had also faced the same error

'pango_context_set_round_glyph_positions' not found in library

i think you must be using weasyprint version 53.0 which requires pango version 1.44.0+

downgrading the weasyprint version to 52.5 solved my issue.because this does not require recent version of pango.

you can also check this https://github.com/Kozea/WeasyPrint/issues/1384

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!