From 16096b1abe03e221d25f708b33ed1a3a6ca02f89 Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Sat, 11 May 2024 14:43:11 +0900 Subject: [PATCH] Warn on using legacy methods (#45) Add notice to warn people that the legacy_* methods may not work on all browsers. --- streamlit_pdf_viewer/__init__.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/streamlit_pdf_viewer/__init__.py b/streamlit_pdf_viewer/__init__.py index 058ae81b..59af9ef1 100644 --- a/streamlit_pdf_viewer/__init__.py +++ b/streamlit_pdf_viewer/__init__.py @@ -25,9 +25,9 @@ ) -def pdf_viewer(input: Union[str, Path, bytes], - width: int = 700, - height: int = None, +def pdf_viewer(input: Union[str, Path, bytes], + width: int = 700, + height: int = None, key=None, annotations: list = (), pages_vertical_spacing: int = 2, @@ -70,9 +70,11 @@ def pdf_viewer(input: Union[str, Path, bytes], binary = fo.read() else: binary = input - + if rendering == RENDERING_IFRAME or rendering == RENDERING_EMBED: - if height is None: + print(f"{RENDERING_IFRAME} and {RENDERING_EMBED} may not work consistently on all browsers " + f"they might disapper in future releases.") + if height is None: height = "100%" base64_pdf = base64.b64encode(binary).decode('utf-8')