Print -> Save as PDF produce blank pages

Summary

I am trying to export my streamlit app to pdf though native print->save as pdf option.

However, this option produce some artifacts as seen below. Any suggestions how to fix it?

Hi @kawanovs

Could you share code snippet for reproducing the issue faced, which would be helpful for the community in seeing the code and help with debugging.

Hi @dataprofessor ,

Please see the code snippet below. I have made a simple case to replicate given behavior. Commenting st.sidebar.success will fix the issue.

class DailyReport:

__version__ = "0.1"
__name__ = "Daily Report"

def __init__(self):
    st.set_page_config(page_title=f'{self.__name__} {self.__version__}',
                       page_icon="πŸ“Š",
                       layout="wide",
                       initial_sidebar_state="collapsed")
    allow_scroll = """
                    <style>
                        .stApp{ position: relative !important;}
                        .appview-container{ position: relative !important;}
                    </style>
                    """
    st.markdown(allow_scroll, unsafe_allow_html=True)
    self.database = DatabaseUtilities()

def header(self):
    st.markdown("""
    <h1 style='text-align: center; margin-bottom: -35px;'>
    Daily reporting
    </h1>""", unsafe_allow_html=True)

def run(self):
    self.header()

class DatabaseUtilities:

def __init__(self):

    self.mode = self.check_connection()

def check_connection(self):
    try:
        st.sidebar.success("Database connection is active.")
        return 'SQL'
    except OperationalError:
        st.sidebar.error("Database connection is not active.")
        return 'Local'

DailyReport().run()

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.