1

I am using a simple Python file for generating PDF. The Python output is correct, but the PDF output has that issue:

enter image description here

This is not the correct format of these Hindi words.

This is the original text: अतिदेय राशि के पुनर्भुगतान हेतु अनुस्मारक

fileName = 'MyDoc.pdf'
title = 'श्रीमान मुख्य अभियंता संदर्भ संख्या'

from reportlab.pdfgen import canvas
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfmetrics

pdfmetrics.registerFont(TTFont("mangal", "Lohit-Devanagari.ttf"))
pdf = canvas.Canvas(fileName)
# ###################################
pdf.setFont('mangal', 36)
pdf.drawCentredString(300, 770, title)
pdf.save()

this is the output pdf file: Lohit-Devanagari.ttf is unicode font for hindi enter image description here

0 Answers0