# !/usr/bin/env python # -*- coding: utf-8 -*- #引入所需要的基本包 import reportlab.rl_config reportlab.rl_config.warnOnMissingFontGlyphs = 0 from reportlab.pdfbase import pdfmetrics from reportlab.pdfbase.ttfonts import TTFont from reportlab.pdfgen import canvas pdfmetrics.registerFont(TTFont('song', 'SURSONG.TTF')) pdfmetrics.registerFont(TTFont('hei', 'SIMHEI.TTF')) c=canvas.Canvas("123.pdf") c.setFont('hei', 35) title= '浙江泰隆商业银行ESB日报' print type(title) title=title.decode('utf8') print title print type(title) c.drawString(100,100,title) c.showPage() c.save()