Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

281
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda