[reportlab-users] still no working
Jerome Alet
reportlab-users@reportlab.com
Sun, 2 Nov 2003 09:22:11 +0100
On Sat, Nov 01, 2003 at 05:21:59PM -0800, sarah el-lawindy wrote:
>
> hi again,
>
> i know that this piece of code works well,it is in the guide and i tried and it worked with, but it did not work with the piece of code i send u before, no error, and no pdfs as well.
>
> what i mean
>
> 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
> c = canvas.Canvas("hello.pdf")
> pdfmetrics.registerFont(TTFont('Rina', 'rina.ttf'))
> c.setFont(Rina, 32)
> c.drawString(10, 150, "Some text encoded in UTF-8")
> c.drawString(10, 100, "In the Rina TT Font!")
>
> did not generate a pdf file, although there is no error ..
>
> i hope u got what i mean ..
I'm sorry but again the code you are showing miss the c.save() call,
and so no PDF file is generated.
If the above code is the integrality of your code, then add c.save()
at the end and the file will be generated.
Also the setFont call causes an error, because Rina should be enclosed
between quotes.
Also did you put the complete path to the rina.ttf file or copy the
file in your current directory ?
The following works fine here :
--- CUT ---
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
c = canvas.Canvas("hello.pdf")
pdfmetrics.registerFont(TTFont('Rina', 'rina.ttf'))
c.setFont("Rina", 32)
c.drawString(10, 150, u"Some text encoded in UTF-8")
c.drawString(10, 100, u"In the Rina TT Font!")
c.showPage()
c.save()
--- CUT ---
Jerome Alet
--
"A non-free program is a predatory social system that keeps people
in a state of domination and division, and uses the spoils to
dominate more." - RMS