python用FPDF写的会计支出凭单

效果图

from fpdf import FPDF

ziti_path = './simkai.ttf'
# ziti_path = './simhei.ttf'

pdf = FPDF()
pdf.set_top_margin(0.0)
pdf.add_page('p')
pdf.add_font('heiti', '', ziti_path, uni=True)
#龙阔
pdf.set_line_width(0.0)
# pdf.rect(0.0, 0.0, 210.0, 297.0)  # 坐标1,2宽度3,4
pdf.dashed_line(0.0, 148.5, 210.0, 148.5)  # 坐标1,2宽度3,4

#上
pdf.set_font('heiti', '', 20.0)
pdf.set_xy(80.0, 5.0)  # 预设基础XY位置数字
pdf.cell(ln=0, h=13.0, align='L', w=0, txt='支  出  凭  单', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.5)
pdf.rect(70.0, 16.0, 70.0, 0.0)  # 标题
#年月日
pdf.set_font('heiti', '', 13.0)
pdf.set_xy(105.0, 10.0)  # 预设基础XY位置数字
pdf.cell(ln=0, h=35.0, align='L', w=0.0, txt='年    月    日', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_xy(175.0, 10.0)  # 预设基础XY位置数字
pdf.cell(ln=0, h=35.0, align='L', w=0.0, txt='第     号', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.rect(10.0, 32.0, 190.0, 100.0)  # 坐标1,2宽度3,4


#框内内容
pdf.set_font('heiti', '', 13.0)
pdf.set_xy(15.0, 10.0)
pdf.cell(ln=0, h=75.0, align='L', w=0.0, txt='即    付', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.dashed_line(35.0, 53.0, 190.0, 53.0)
pdf.set_line_width(0.0)
######dashed_line
pdf.dashed_line(35.0, 73.0, 120.0, 73.0)
pdf.set_xy(120.0, 10.0)
pdf.cell(ln=0, h=120.0, align='L', w=0.0, txt='款', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.rect(140.0, 60.0, 50.0, 12.0)
pdf.set_font('heiti', '', 10.0)
pdf.set_xy(140.0, 10.0)
pdf.cell(ln=0, h=112.0, align='L', w=0.0, txt='对方科目编号', border=0)  # h文字Y轴位置,w文字X轴位置
#计人民币
pdf.set_font('heiti', '', 13.0)
pdf.set_xy(15.0, 45.0)
pdf.cell(ln=0, h=95.0, align='L', w=0.0, txt='计人民币:', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.dashed_line(35.0, 96.0, 150.0, 96.0)
pdf.set_xy(150.0, 45.0)
pdf.cell(ln=0, h=100.0, align='L', w=0.0, txt='¥', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.line(155.0, 96.0, 190.0, 96.0)
#领款人
pdf.set_font('heiti', '', 13.0)
pdf.set_xy(15.0, 45.0)
pdf.cell(ln=0, h=150.0, align='L', w=0.0, txt='领 款 人:', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.line(35.0, 125.0, 110.0, 125.0)
pdf.set_xy(115.0, 45.0)
pdf.cell(ln=0, h=150.0, align='L', w=0.0, txt='主管审批:', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.line(135.0, 125.0, 190.0, 125.0)
#底部
pdf.set_font('heiti', '', 10.0)
pdf.set_xy(15.0, 55.0)
pdf.cell(ln=0, h=160.0, align='L', w=0.0, txt='财务主管:', border=0)
pdf.set_xy(55.0, 55.0)
pdf.cell(ln=0, h=160.0, align='L', w=0.0, txt='记账:', border=0)
pdf.set_xy(95.0, 55.0)
pdf.cell(ln=0, h=160.0, align='L', w=0.0, txt='出纳:', border=0)
pdf.set_xy(135.0, 55.0)
pdf.cell(ln=0, h=160.0, align='L', w=0.0, txt='审核:', border=0)
pdf.set_xy(175.0, 55.0)
pdf.cell(ln=0, h=160.0, align='L', w=0.0, txt='制单:', border=0)
pdf.ln()
pdf.ln()



#下
gao = 148.5
pdf.set_font('heiti', '', 20.0)
pdf.set_xy(80.0, 5.0+gao)  # 预设基础XY位置数字
pdf.cell(ln=0, h=13.0, align='L', w=0, txt='支  出  凭  单', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.5)
pdf.rect(70.0, 16.0+gao, 70.0, 0.0)  # 标题
#年月日
pdf.set_font('heiti', '', 13.0)
pdf.set_xy(105.0, 10.0+gao)  # 预设基础XY位置数字
pdf.cell(ln=0, h=35.0, align='L', w=0.0, txt='年    月    日', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_xy(175.0, 10.0+gao)  # 预设基础XY位置数字
pdf.cell(ln=0, h=35.0, align='L', w=0.0, txt='第     号', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.rect(10.0, 32.0+gao, 190.0, 100.0)  # 坐标1,2宽度3,4


#框内内容
pdf.set_font('heiti', '', 13.0)
pdf.set_xy(15.0, 10.0+gao)
pdf.cell(ln=0, h=75.0, align='L', w=0.0, txt='即    付', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.dashed_line(35.0, 53.0+gao, 190.0, 53.0+gao)
pdf.set_line_width(0.0)
######dashed_line
pdf.dashed_line(35.0, 73.0+gao, 120.0, 73.0+gao)
pdf.set_xy(120.0, 10.0+145)
pdf.cell(ln=0, h=120.0, align='L', w=0.0, txt='款', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.rect(140.0, 60.0+gao, 50.0, 12.0)
pdf.set_font('heiti', '', 10.0)
pdf.set_xy(140.0, 10.0+gao)
pdf.cell(ln=0, h=112.0, align='L', w=0.0, txt='对方科目编号', border=0)  # h文字Y轴位置,w文字X轴位置

#计人民币
pdf.set_font('heiti', '', 13.0)
pdf.set_xy(15.0, 241)
pdf.cell(ln=0, h=0.0, align='L', w=0.0, txt='计人民币:', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.dashed_line(35.0, 96.0+gao, 150.0, 96.0+gao)
pdf.set_xy(150.0, 241)
pdf.cell(ln=0, h=0.0, align='L', w=0.0, txt='¥', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.line(155.0, 96.0+gao, 190.0, 96.0+gao)
#领款人

pdf.set_font('heiti', '', 13.0)
pdf.set_xy(15.0, 270.0)
pdf.cell(ln=0, h=0.0, align='L', w=0.0, txt='领 款 人:', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.line(35.0, 125.0+gao, 110.0, 125.0+gao)
pdf.set_xy(115.0, 270.0)
pdf.cell(ln=0, h=0.0, align='L', w=0.0, txt='主管审批:', border=0)  # h文字Y轴位置,w文字X轴位置
pdf.set_line_width(0.0)
pdf.line(135.0, 125.0+gao, 190.0, 125.0+gao)

#底部
pdf.set_font('heiti', '', 10.0)
pdf.text(15.0,285.0,'财务主管:')
pdf.text(55.0,285.0,'记账:')
pdf.text(95.0,285.0,'出纳:')
pdf.text(135.0,285.0,'审核:')
pdf.text(175.0,285.0,'制单:')

pdf.output('./4.pdf', 'F')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值