Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic resizing of pdf_viewer #74

Open
trish11953 opened this issue Oct 28, 2024 · 1 comment
Open

Dynamic resizing of pdf_viewer #74

trish11953 opened this issue Oct 28, 2024 · 1 comment

Comments

@trish11953
Copy link

If I add a pdf_viewer in a column in the Streamlit sidebar, the pdf_viewer does not use full container width to resize the pdf_viewer if the width of sidebar is changed. Is there a way to make it dynamic?

@Odrec
Copy link

Odrec commented Oct 29, 2024

I use this component to get the dimensions of the streamlit container the pdf viewer is in: https://github.com/avsolatorio/streamlit-dimensions

Then I do something like:

pdf_viewer(input=pdf,
           height=1000,
           width=int(container_dim['width'] * 0.4) if container_dim else 400,
           render_text=True)

That renders the pdf in a 40% of the width of the container it is in and also resizes with the container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants