Summary
For my use case I want to run small ajustements on the app content before printing it with the print option button in the hamburger menu.
Example
app.py:
import streamlit as st
st.write("<p id='PrintSpaceBlock'>test</p>", unsafe_allow_html=True)
Manually changing the content in the console:
element = document.getElementById("PrintSpaceBlock")
backup = element.innerHTML
element.innerHTML = "test<br><br>test"
Printing the app:
Restoring the original content after the print:
element.innerHTML = backup
Question
How to make the print button automatically triggers the javascript code for pre and post processing as shown above ?