用户:
超级骑士花卷喵查看:29 回复:1 评论:0 创建时间:2021-02-19T15:05:14
from
reportlab.pdfbase
import
pdfmetrics
from
reportlab.pdfbase.ttfonts
import
TTFont
from
reportlab.lib.colors
import
red
,
yellow
,
green
,
blue
,
pink
,
grey
from
reportlab.pdfgen
import
canvas
import
webbrowser
import
os
pdfmetrics.registerFont
(
TTFont
(
"CQ"
,
"fangzheng.TTF"
))
wow = canvas.Canvas
(
"源码表单.pdf"
,
pagesize=
(
888
,
888
))
wow.setFont
(
"CQ"
,
100
)
wow.drawCentredString
(
444
,
800
,
"调查表"
)
pop = wow.acroForm
wow.setFont
(
"CQ"
,
30
)
wow.drawCentredString
(
333
,
650
,
"姓名:"
)
pop.textfield
(
x=
400
,
y=
650
,
width=
100
,
height=
25
,
fillColor=blue
,
textColor=green
,
borderColor=red
,
fontSize=
25
)
wow.setFont
(
"CQ"
,
30
)
wow.drawCentredString
(
333
,
550
,
"性别:"
)
wow.setFont
(
"CQ"
,
30
)
wow.drawString
(
403
,
550
,
"男"
)
pop.checkbox
(
x=
453
,
y=
550
,
buttonStyle=
"check"
,
borderColor=blue
)
wow.setFont
(
"CQ"
,
30
)
wow.drawString
(
503
,
550
,
"女"
)
pop.checkbox
(
x=
553
,
y=
550
,
buttonStyle=
"check"
,
borderColor=red
)
wow.setFont
(
"CQ"
,
30
)
wow.drawCentredString
(
333
,
450
,
"评价:"
)
pop.choice
(
x=
400
,
y=
450
,
value=
"choice"
,
options=
[
"choice"
,
"Very Good"
,
"Good"
,
"average"
,
"Bad Because BUG"
,
"Bad Because shabby"
,
"Very Bad"
]
)
wow.setFont
(
"CQ"
,
30
)
wow.drawCentredString
(
333
,
350
,
"寄语(填完后退出即可发送):"
)
pop.textfield
(
x=
400
,
y=
0
,
width=
400
,
height=
330
,
fieldFlags=
"multiline"
,
fillColor=blue
,
textColor=green
,
borderColor=red
,
fontSize=
25
)
wow.save
()
print
(
"保存成功!"
)
webbrowser.
open
(
"file://"
+ os
.path.realpath
(
"源码表单.pdf"
))