Slide postprocessing#

Sometimes you may want to add some global data to your slides, for example a footer, license information or slide numbers. To make it easier, you can pass a function to the slide_postprocessing parameter of the render method. The function will receive a list of root boxes of each slide in the presentation. You can then go through the list and modify the slides, for example by adding some text to them.

Slide numbering#

It is quite easy to add numbers to each slide using slide postprocessing. Here is an example:

import elsie
slides = elsie.SlideDeck()

def slide1(slide):
    slide.text("Page numbering demo")

def slide2(slide):"Hello world!")"next+").text("Hello world!")"next+").text("Hello world!")

def slide3(slide):"Last slide")

def page_numbering(slides):
    for i, slide in enumerate(slides):"90%", y="90%", width=70, height=45).rect(
            bg_color="orange", rx=5, ry=5
        ).text(f"{i + 1}/{len(slides)}")


You can find the rendered PDF with slide numbers here.

You could also easily create a fragment number for each fragment of each slide by iterating numbers up to the current_fragment() of each slide.