pagesize doesn't work in Reportlab simpledocTemplate

ⅰ亾dé卋堺 提交于 2020-01-15 08:31:57

问题


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)

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


回答1:


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)



回答2:


But where from do you import portrait() method and A5 value?



来源:https://stackoverflow.com/questions/13776672/pagesize-doesnt-work-in-reportlab-simpledoctemplate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!