Python 3 Reportlab Library Script to Create Simple PDF Document Containing Some Text Full Example For Beginners

Python 3 Reportlab Library Script to Create Simple PDF Document Containing Some Text Full Example For Beginners

 

Welcome folks today in this tutorial we will be creating a simple pdf document using reportlab library in python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to install the following library using the pip command as shown below

 

pip install reportlab

 

After installing this library make an app.py file and copy paste the following code

 

app.py

 

from reportlab.pdfgen import canvas

c = canvas.Canvas("output.pdf")

c.drawString(50,50,"This is a simple text written by reportlab library")

c.save()

 

Now if you execute the above script by typing the below command as shown below

 

python app.py

 

 

As you can see it has created the output.pdf file containing the text that we mentioned inside the python script

Leave a Reply