5๐
โ
You can do it by overloading a default CSS definition.
To get the current default CSS use the command line tool like this:
xhtml2pdf --css-dump > /path-to-your-project/default.css
Then, open the resulting file and insert the following line at the end:
@page { size: A5 }
In your code, you can use the resulting file as follows:
pdf = pisa.pisaDocument(StringIO.StringIO(html.encode("ISO-8859-1")), result, default_css=open('default.css','r').read())
๐คNorthCat
-1๐
Simply writing the snippet below in the style tag, did the trick for me.
@page { size: A5 }
๐คtablebubble
- [Django]-Should I not be using Django per-site caching?
- [Django]-Django: Avoid HTTP API calls while testing from django views
- [Django]-Django-Rest-Framework CreateAPIView not working
Source:stackexchange.com