Bonjour,
les caractères en arabe ne s'affichent pas correctement, à la place j'ai des symboles
en m'appuyant sur ce tuto https://www.codingforentrepreneurs.c...pdf-in-django/, voici mon code:
[python 2.7; Django 1.11]
template
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 from .utils import render_to_pdf #created in step 4 class GeneratePdf(View): def get(self, request, *args, **kwargs): tar= u"محاولة" data = {'dem1': dem1,'dem2':dem2,'tar':tar} pdf = render_to_pdf('pdf2.html', data) return HttpResponse(pdf, content_type='application/pdf')
Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html"; charset=UTF-8"> <link href="http://allfont.net/allfont.css?fonts=ds-arabic" rel="stylesheet" type="text/css" /> <style> body { font-family: 'DS Arabic', arial; font-size: 40px; text-shadow: 4px 4px 4px #aaa; } </style> <title>title</title> </head> <body> <div><p>محاولة الكتابة باللغة العربية</p></div> <p>{{dem1.demandeur.profile.nom_prenom_ar}}</p> </body> </html>
Pouvez vous m'aider SVP ?
Partager