Posts

Showing posts from May, 2026

File Operation in Python, generate pdf using reportlab

https://docs.reportlab.com/demos/hello_world/hello_world/ >python -m venv venv                                            > venv/scripts/activate >pip install reportlab crate a file in same fomder and past code from following link: https://docs.reportlab.com/demos/hello_world/hello_world/ To run file: >python filename.py ////////////////////////////// # import the canvas object from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import A4 # create a pdf document using path my_pdf= "my_report.pdf" # creates a canvas object c=canvas.Canvas(my_pdf,bottomup= 1 ,pagesize=A4) # using the pagesize to get the width and height #default page size unit is pt 1'=72pt w,h=int(A4[ 0 ]),int(A4[ 1 ]) print(w,h) #we can customize page size from reportlab.lib.units import inch, cm # কাস্টম সাইজ ডিফাইন করা (প্রস্থ, উচ্চতা) custom_size = ( 10 *inch, 5 *inch) # ক্যানভা...