From 4fe89b97320fa768679212ba530b96b771818fa5 Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Tue, 20 Aug 2024 07:13:21 +0200 Subject: [PATCH 1/5] place annotations on top of the PDF and below the text layers --- streamlit_pdf_viewer/frontend/src/PdfViewer.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/streamlit_pdf_viewer/frontend/src/PdfViewer.vue b/streamlit_pdf_viewer/frontend/src/PdfViewer.vue index f0a905c..4d77b5b 100644 --- a/streamlit_pdf_viewer/frontend/src/PdfViewer.vue +++ b/streamlit_pdf_viewer/frontend/src/PdfViewer.vue @@ -93,7 +93,7 @@ export default { outline: `${props.args.annotation_outline_size * scale}px solid`, outlineColor: annoObj.color, cursor: 'pointer', - 'z-index': 10 + 'z-index': 1 }; if (index) { loadedAnnotations.value.push(`annotation-${index}`); @@ -139,6 +139,7 @@ export default { const textContent = await page.getTextContent(); const textLayerDiv = document.createElement("div"); textLayerDiv.className = "textLayer" + textLayerDiv.style = "z-index: 2" // textLayerDiv.style.position = "absolute"; // textLayerDiv.style.height = `${viewport.height}px`; // textLayerDiv.style.width = `${viewport.width}px`; From b4a4ad380199bf0f9dd91728e48629f1e206bf03 Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Tue, 20 Aug 2024 07:16:26 +0200 Subject: [PATCH 2/5] =?UTF-8?q?Bump=20version:=200.0.18-dev0=20=E2=86=92?= =?UTF-8?q?=200.0.18-dev1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bumpversion.toml b/.bumpversion.toml index 04afb09..5fe6d50 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -1,5 +1,5 @@ [tool.bumpversion] -current_version = "0.0.18-dev0" +current_version = "0.0.18-dev1" commit = "true" tag = "true" tag_name = "v{new_version}" From 43fe276213a59e74969f8eefb9403fca824b9b5e Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Fri, 30 Aug 2024 06:25:23 +0200 Subject: [PATCH 3/5] add some documentation --- README.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f475a88..143237f 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,23 @@ Tested on Chrome and Firefox. You can see an [application](https://github.com/lf -### Work in progress -We are early in the development, and we appreciate new contributors. +## Features +- Show PDF files in a Streamlit application with a simple command +- Based on the pdf.js library +- Support showing the PDF with the native pdf.js browser's viewer: "legacy" (with limitations, no annotations, no scrolling, etc..) +- Visualize annotations on top of the PDF documents +- Render text on top of the PDF document, allowing copy-paste +- Allow to render specific pages of the PDF document +- Scroll to a specific page +- Scroll to a specific annotation + +## Limitations +- The component is developed on Firefox, however we are trying to make it compatible with Chrome as well. +- The legacy visualization works only on Firefox and does not support annotations +- Our Javascript skills are limited, so all troubleshooting may take time +- The component is still in development, so expect some bugs and limitations +- The streamlit reload at each action may render slowly for complex PDF documents + ## Getting started From 2f4b2185843af74e1f43d9975f890460dd8d0604 Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Fri, 30 Aug 2024 07:12:36 +0200 Subject: [PATCH 4/5] add caveats and some revision --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 143237f..63b376a 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ # streamlit-pdf-viewer -Streamlit component that allows the visualisation and enrichment of PDF documents -Tested on Chrome and Firefox. You can see an [application](https://github.com/lfoppiano/structure-vision) in action [here](https://structure-vision.streamlit.app/). +Streamlit component that allows the visualisation and enrichment of PDF documents. +You can see an [application](https://github.com/lfoppiano/structure-vision) in action [here](https://structure-vision.streamlit.app/). @@ -21,7 +21,7 @@ Tested on Chrome and Firefox. You can see an [application](https://github.com/lf - Scroll to a specific annotation ## Limitations -- The component is developed on Firefox, however we are trying to make it compatible with Chrome as well. +- Tested and developed to support Firefox and Chrome. - The legacy visualization works only on Firefox and does not support annotations - Our Javascript skills are limited, so all troubleshooting may take time - The component is still in development, so expect some bugs and limitations @@ -43,7 +43,12 @@ from streamlit_pdf_viewer import pdf_viewer pdf_viewer("str, path or bytes") ``` -## Options +### Caveats + +Here some caveats to be aware of: +- Is mandatory to specify a `width` to show PDF document on tabs and expanders, otherwise, the viewer will not be displayed on tabs not immediately visible. +- The `legacy` rendering is not supported on Chrome, due to security reasons. + ### Params From a96da5b16b2dbff7fe9743e4dc1d3dd8c604e699 Mon Sep 17 00:00:00 2001 From: Luca Foppiano Date: Fri, 30 Aug 2024 07:29:46 +0200 Subject: [PATCH 5/5] =?UTF-8?q?Bump=20version:=200.0.18-dev1=20=E2=86=92?= =?UTF-8?q?=200.0.18-rc0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .bumpversion.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bumpversion.toml b/.bumpversion.toml index 5fe6d50..fa718cc 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -1,5 +1,5 @@ [tool.bumpversion] -current_version = "0.0.18-dev1" +current_version = "0.0.18-rc0" commit = "true" tag = "true" tag_name = "v{new_version}"