I am using the python xhtml2pdf module and the pisa class to create a PDF. Now the PDF is in vertical A4 format, how do I change it to have the PDF to landscape layout?
import xhtml2pdf.pisa as pisa
result = StringIO()
pdf = pisa.CreatePDF(
StringIO("This is my PDF"),
result)
Use the following CSS:
@page {
size: letter landscape;
margin: 2cm;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With