Python Code
1 from [Link] import A4 from [Link] import canvas fr
om [Link] import colors
2
3 Page settings
4
5 page_width, page_height = A4 cell_height = 25 cell_widths = [200, 70, 70, 70,
70, 70] # Chapter, 1st,2nd,Rev,PYQ,Fully
6
7 Subjects and chapters
8
9 pdf_data = [ {"heading": "Science", "topics": [ ("Chemistry", 4), ("Physics",
4), ("Biology", 5) ]}, {"heading": "Math", "topics": [("Math", 14)]}, {"heading": "S
ST", "topics": [ ("Geography", 7), ("History", 5), ("Economics", 4), ("Civics", 5)
]}, {"heading": "English", "topics": [ ("First Flight", 9), ("Poetry", 10), ("Footpr
ints Without Feet", 9) ]} ]
10
11 Create PDF
12
13 c = [Link]("[Link]", pagesize=A4)
14
15 for subject in pdf_data: [Link]("Helvetica-Bold", 20) [Link]
(page_width/2, page_height-50, subject['heading'])
16
17 y = page_height - 100
18 [Link]("Helvetica", 12)
19 for topic, chapters in subject['topics']:
20 for i in range(1, chapters+1):
21 x = 50
22 # Draw table cells
23 for w in cell_widths:
24 [Link](x, y-cell_height, w, cell_height)
25 x += w
26 y -= cell_height
27 if y < 50:
28 [Link]()
29 [Link]("Helvetica", 12)
30 y = page_height - 50
31
32 [Link]()
33
34 [Link]() print("PDF generated as [Link]")