pagesize 在 Reportlab simpledocTemplate 中不起作用 [英] pagesize doesn't work in Reportlab simpledocTemplate

查看:52
本文介绍了pagesize 在 Reportlab simpledocTemplate 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 ReportLab 生成 PDF 报告.我使用了 SimpleDocTemplate 并设置了 pageSize = A5.但是在构建PDF后,当我打开创建的文件时,页面大小为A4.

I am using ReportLab for generating a PDF report. I've used SimpleDocTemplate and set pageSize = A5. but after bulding the PDF, when i open created file, the size of page is A4.

doc = SimpleDocTemplate(file_name, pageSize = A5)
doc.build(report)

我尝试了其他页面大小,但创建的文件大小没有改变并保持 A4!我该怎么办?

I tried other page size but the created file size doesn't change and remain A4! what should i do?

推荐答案

我的问题解决了!除了页面大小及其工作之外,我刚刚使用了横向或纵向设置!

My Problem solved! I had just used landscape or portrait setting in additional to page size and its work!

doc = SimpleDocTemplate(file_name)
doc.pagesize = portrait(A5)
doc.build(report)

这篇关于pagesize 在 Reportlab simpledocTemplate 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆