Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to increase the slide size a python generated powerpoint presentation using python-pptx

Am trying to fit multiple charts into a python generated slide but I need the size of the slide to be wider. I looked through the available documentation provided which aren't much.

like image 803
K. Abhulimen Avatar asked Dec 23 '22 10:12

K. Abhulimen


1 Answers

The default width and height for a slide generated by pptx is 10 inches width and 7.5 inches height. The following code will work to change its default slide width and height:

from pptx import Presentation
from pptx.util import Inches


prs = Presentation()
# set width and height to 16 and 9 inches.
prs.slide_width = Inches(16)
prs.slide_height = Inches(9)
like image 66
jdhao Avatar answered Dec 25 '22 22:12

jdhao