2016-03-28 9 views
1

Ich benutze das python xhtml2pdf Modul und die pisa Klasse um ein PDF zu erstellen. Jetzt ist das PDF im A4-Format, wie ändere ich es, um das PDF in Landscape-Layout zu bringen?Python xhtml2pdf um PDF im Querformat zu erzeugen

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

Antwort

5

Verwenden Sie das folgende CSS:

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