gpt4 book ai didi

Python xhtml2pdf 横向生成PDF

转载 作者:太空宇宙 更新时间:2023-11-04 07:35:46 30 4
gpt4 key购买 nike

我正在使用 python xhtml2pdf 模块和 pisa 类来创建 PDF。现在 PDF 是竖版 A4 格式,如何将其更改为横向布局?

import xhtml2pdf.pisa as pisa
result = StringIO()
pdf = pisa.CreatePDF(
StringIO("This is my PDF"),
result)

最佳答案

使用以下 CSS:

@page {
size: letter landscape;
margin: 2cm;
}

关于Python xhtml2pdf 横向生成PDF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36270786/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com