forked from wasmerio/Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
31 lines (22 loc) · 827 Bytes
/
Copy pathscript.py
File metadata and controls
31 lines (22 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from reportlab.lib.enums import TA_JUSTIFY
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
context=[]
img="img.jpg"
doc = SimpleDocTemplate("result.pdf",pagesize=letter,
rightMargin=72,leftMargin=72,
topMargin=72,bottomMargin=18)
im = Image(img, 2*inch, 2*inch)
context.append(im)
context.append(Spacer(3, 20))
styles=getSampleStyleSheet()
styles.add(ParagraphStyle(name='Justify', alignment=TA_JUSTIFY))
with open('input.txt') as f:
while True:
line = f.readline()
if not line:
break
context.append(Paragraph(line, styles["Normal"]))
doc.build(context)