[reportlab-users] reportlab basic problem

Tim Smith reportlab-users@reportlab.com
Thu, 16 Sep 2004 12:01:30 +1000


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
ok it's outputs a file now, but i don't see "hello world" when i open
it? it just a blank page, i'm in win98 using adobe 6
Robin Becker wrote:

| jpywtora@calpoly.edu wrote:
|
|>> hello i have started readingthe user guide for replort lab, but i
|>> have
|>> hit a probelm right away
|>>
|>> from reportlab.pdfgen import canvas
|>> def hello(c):
|>> ~    c.drawString(100,100, "Hello World")
|>> c = canvas.Canvas("c:\hello.pdf")
|>> c.showPage()
|>> c.save
|>
|>
|>
|> Could it be that save is a function and should be c.save() vs c.save?
|>
|>
|>
|>> print "finished"
|>>
|>> this code does not error, but produces no pdf file as the examples
|>> says it should... have i installed it incorrectly or is the user
|>> guide
|>> wrong?
|>>
|>
|>
|> Johnny P
|>
| I belive that's part of the problem. Another thing is that like many
| other languages Python regards \ as an escape so you should change
| the Canvas call to  one of
|
| c = canvas.Canvas("c:\\hello.pdf") #escape the escape
| c = canvas.Canvas(r"c:\hello.pdf") #use raw string \ not treated
| specially
| c = canvas.Canvas("c:/hello.pdf")  #windows allows this as well
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
 
iD8DBQFBSPP5lDz0jt7WNwoRAv19AKDm96kdsWtwkkfATRQ2z9NiE5WhYQCglGLW
BbzaeJJqGwQxYUk6B/dMiHo=
=M6kf
-----END PGP SIGNATURE-----