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

Support width in percentage #30 #39

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

t29mato
Copy link
Collaborator

@t29mato t29mato commented Mar 1, 2024

Support #30

Maybe this is solution for #35 and #37, too.

@t29mato t29mato self-assigned this Mar 1, 2024
Copy link
Owner

@lfoppiano lfoppiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we implement the same without using an external library?

I think the default value to 40% should be removed, maybe 100% is a better default?

requirements.txt Show resolved Hide resolved
streamlit_pdf_viewer/__init__.py Outdated Show resolved Hide resolved
@t29mato t29mato changed the title Support width in percentage #30 Support width in percentage #30 [wip] Mar 1, 2024
@t29mato t29mato changed the title Support width in percentage #30 [wip] [WIP] Support width in percentage #30 Mar 1, 2024
@lfoppiano lfoppiano changed the title [WIP] Support width in percentage #30 Support width in percentage #30 Mar 1, 2024
Copy link
Owner

@lfoppiano lfoppiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The height at 100% (if it's doable) would solve issue #35

@@ -33,7 +33,7 @@ In the following table the list of parameters that can be provided to the `pdf_v
| name | description |
|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| input | The source of the PDF file. Accepts a file path, URL, or binary data. |
| width | Width of the PDF viewer in pixels. It defaults to 700 pixels. |
| width | The width of the PDF viewer defaults to 100% of the layout. Specify in pixels with a numeric value, or as a percentage for relative sizing. |
| height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about having height = 100% by default too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried it and pushed it here 5443edb
But, it's outer height not inner height. The custom javascript returned 0 as value when I retrieve inner height because of iframe problem
ref: https://developer.mozilla.org/en-US/docs/Web/API/Window/outerHeight

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK forget about it, we can address the height-related issue in #41

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, do you think I should revert it? Because I've already pushed the code which supports outerHeight.

…er height which is supposed to be inner height
@lfoppiano lfoppiano self-requested a review March 6, 2024 06:17
Copy link
Owner

@lfoppiano lfoppiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please merge the main in this branch, run the tests and eventually add new ones 😅

@t29mato
Copy link
Collaborator Author

t29mato commented Mar 6, 2024

Could you please merge the main in this branch, run the tests and eventually add new ones 😅

I've merged it.
But of course, we need to fix the integration tests.

@lfoppiano lfoppiano marked this pull request as draft March 19, 2024 10:56
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

Successfully merging this pull request may close these issues.

None yet

2 participants