简体   繁体   中英

How can I make pdf with snippet in reportlab

I am new in programming and have got weak background to deal with snippet. My problem is that I have no idea about how to use the snippet included in the ReportLab user guide

https://www.reportlab.com/docs/reportlab-userguide.pdf

I just follow by this protocol All I have done is the code in section 2.1 - 2.6 But in section 2.7, I have no idea how to use function (def...) to create pdf

My question is:

(1) What is the basic background that I should know? (2) Could you please give me some example code that show how to deal with this stuff?

Try this tutorial. The snippet below should create a file "hello.pdf" in the same directory as your python script.

http://www.blog.pythonlibrary.org/2010/03/08/a-simple-step-by-step-reportlab-tutorial/

from reportlab.pdfgen import canvas

c = canvas.Canvas("hello.pdf")
c.drawString(100,750,"Welcome to Reportlab!")
c.save()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM