How can I Formate my Streamlit Printing output to print each section in different pages

Looking for a way to output the main content of my streamlit app to a pdf but have problems trying to look for way so that the output of the print is well formated on the print.

So my application takes in a 4 Data files that are xlsx and then with streamlit automates a report from this. the web view is awsome thanks to the streamlit awsomeness. but I need to export it as a pdf file which the following problem is shown below.

Problems shown.

  • Sidebar is part of the print and I dont want this (How to remove side bar from the Print )

  • I want to format the Footer and Header

  • How to fit each section in to its own page

Really appreciate any suggestions or Links to external resources to assist with this in terms of further readings or Videos that would be helpful to learn how this can be achieved.

Hi @sweetrush

Are you saving a PDF manually from the browser? Would minimizing the sidebar before exporting as PDF helps?

@dataprofessor Thanks for taking the time to help me with my question.

Yes i did try that method of hiding the sidebar but still gives me an empty space that eats up one of the pages.

I did find a work around but I am still looking for a solution. I added a st.text_area() and used the height attribute to push the content of the web page down to page 2 and then just did a custom print from 2-4 skipping the first page. that has the white space I create so that the content of the first page starts on the second page.

so this was my work around. but now have another printing problem is that some our the limit of a PDF to be printed can only reach page 5 any thing add beyond this in the streamlit content does not show up , it seems there might be a height limit that can be printed from a streamlit app.

  • I also have a question about the streamlit content area is that some sort of Iframe , that every time streamlit updates it refeshes the iframe. just wondering. I did see something about a div that was playing with a iframe and also checked that the second problem i might have that the iframe height could be limited to to something around 9000px or a little bit more.

Which i am suspecting could be the problem why the printing cuts off at around that 9000px in height for the full content.

Hi, perhaps you may want to look into using a screenshot capturing software such as Flameshot:

where you can manually scroll and capture a long page.

There’s also a full page capture Chrome extension (GoFullPage):

Thank you @dataprofessor this was very helpful guidance , I am a firefox user so i think I found a similar externsion like the ones you have shared , which is found at the place : FireShot: Full Web Page Screenshots (β™₯β™₯β™₯β™₯β™₯) – Get this Extension for 🦊 Firefox (en-US)

Thank you so much for all the help this has been very useful

1 Like

Glad to hear that :slight_smile:

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