[reportlab-users] About Helvetica font

Enrique Comesaña Figueroa ecomesana at googlemail.com
Fri Oct 24 10:32:09 EDT 2008


Hello,

I am trying to generate a PDF document with embedded fonts. I have no
problem with other fonts but Helvetica. It always appear in the list
of fonts in the properties document even if i do not use it.
And if I try to embed it in a document which uses this font, reportlab
generates it but do not embed the Helvetica font.

Can anyone help me?, If that is not possible, can anyone suggest me
any other way to generate pdf with ALL fonts embedded?

This is my python code:

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

justFace = pdfmetrics.EmbeddedType1Face('./Helvetica.afm', './Helvetica.pfb')
pdfmetrics.registerTypeFace(justFace)
justFont = pdfmetrics.Font('Helvetica','Helvetica','WinAnsiEncoding')
pdfmetrics.registerFont(justFont)

c = Canvas('temp.pdf')
c.setFont('Helvetica', 32)
c.drawString(10, 150, "Some text")
c.save()


I have have the files Helvetica.afm and Helvetica.pfd in the same
folder as the python script
And pdffonts command return me this properties of the PDF document:


>>> pdffonts temp.pdf

name type emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
Helvetica Type 1 no no no 2 0

Many thanks,
Enrique


More information about the reportlab-users mailing list