streamlit-pdf-viewer 0.0.23.dev0__tar.gz → 0.0.23.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/.bumpversion.toml +1 -1
  2. {streamlit_pdf_viewer-0.0.23.dev0/streamlit_pdf_viewer.egg-info → streamlit_pdf_viewer-0.0.23.dev1}/PKG-INFO +69 -51
  3. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/README.md +68 -50
  4. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/index.html +1 -1
  5. streamlit_pdf_viewer-0.0.23.dev1/streamlit_pdf_viewer/frontend/dist/js/app.91327107.js +2 -0
  6. streamlit_pdf_viewer-0.0.23.dev1/streamlit_pdf_viewer/frontend/dist/js/app.91327107.js.map +1 -0
  7. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1/streamlit_pdf_viewer.egg-info}/PKG-INFO +69 -51
  8. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer.egg-info/SOURCES.txt +2 -2
  9. streamlit_pdf_viewer-0.0.23.dev0/streamlit_pdf_viewer/frontend/dist/js/app.3d9d09f3.js +0 -2
  10. streamlit_pdf_viewer-0.0.23.dev0/streamlit_pdf_viewer/frontend/dist/js/app.3d9d09f3.js.map +0 -1
  11. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/MANIFEST.in +0 -0
  12. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/setup.cfg +0 -0
  13. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/setup.py +0 -0
  14. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/__init__.py +0 -0
  15. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/css/app.1df382f3.css +0 -0
  16. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/css/chunk-vendors.ee6905b7.css +0 -0
  17. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/altText_add.7748ee93.svg +0 -0
  18. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/altText_done.1026be11.svg +0 -0
  19. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorFreeHighlight.1fed7bb7.svg +0 -0
  20. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorFreeText.0b596377.svg +0 -0
  21. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorInk.f94c2f42.svg +0 -0
  22. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorTextHighlight.5636640c.svg +0 -0
  23. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/editor-toolbar-delete.6694a89f.svg +0 -0
  24. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/toolbarButton-editorHighlight.c3287eaa.svg +0 -0
  25. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/img/toolbarButton-menuArrow.37a6145d.svg +0 -0
  26. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a7b421ed.js +0 -0
  27. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a7b421ed.js.map +0 -0
  28. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer.egg-info/dependency_links.txt +0 -0
  29. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer.egg-info/requires.txt +0 -0
  30. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/streamlit_pdf_viewer.egg-info/top_level.txt +0 -0
  31. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/__init__.py +0 -0
  32. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/e2e_utils.py +0 -0
  33. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_embed_height.py +0 -0
  34. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_embed_no_args.py +0 -0
  35. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_embed_width.py +0 -0
  36. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_embed_width_height.py +0 -0
  37. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_iframe_height.py +0 -0
  38. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_iframe_no_args.py +0 -0
  39. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_iframe_width.py +0 -0
  40. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_iframe_width_height.py +0 -0
  41. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_invalid_params.py +0 -0
  42. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_rendering_text.py +0 -0
  43. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_resolution_boost.py +0 -0
  44. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_tabs.py +0 -0
  45. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_tabs_2.py +0 -0
  46. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_unwrap_height.py +0 -0
  47. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_unwrap_no_args.py +0 -0
  48. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_unwrap_width.py +0 -0
  49. {streamlit_pdf_viewer-0.0.23.dev0 → streamlit_pdf_viewer-0.0.23.dev1}/tests/test_unwrap_width_height.py +0 -0
@@ -1,5 +1,5 @@
1
1
  [tool.bumpversion]
2
- current_version = "0.0.23-dev0"
2
+ current_version = "0.0.23-dev1"
3
3
  commit = "true"
4
4
  tag = "true"
5
5
  tag_name = "v{new_version}"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-pdf-viewer
3
- Version: 0.0.23.dev0
3
+ Version: 0.0.23.dev1
4
4
  Summary: Streamlit component for PDF visualisation and manipulation
5
5
  Home-page: https://github.com/lfoppiano/streamlit-pdf-viewer
6
6
  Author: Luca Foppiano, Tomoya Mato
@@ -29,11 +29,13 @@ Dynamic: summary
29
29
  # streamlit-pdf-viewer
30
30
 
31
31
  Streamlit component that allows the visualisation and enrichment of PDF documents.
32
- You can see an [application](https://github.com/lfoppiano/structure-vision) in action [here](https://structure-vision.streamlit.app/).
32
+ You can see an [application](https://github.com/lfoppiano/structure-vision) in
33
+ action [here](https://structure-vision.streamlit.app/).
33
34
 
34
35
  <img src="https://github.com/lfoppiano/streamlit-pdf-viewer/raw/main/docs/screenshot.png" width=500 align="right" />
35
36
 
36
37
  ## Features
38
+
37
39
  - Show PDF files in a Streamlit application with a simple command
38
40
  - Based on the pdf.js library
39
41
  - Visualize annotations on top of the PDF documents
@@ -41,26 +43,32 @@ You can see an [application](https://github.com/lfoppiano/structure-vision) in a
41
43
  - Allow to render specific pages of the PDF document
42
44
  - Scroll to a specific page
43
45
  - Scroll to a specific annotation
44
- - Allow custom callbacks when an annotation is clicked
45
- - Additional support showing PDF documents using the native pdf.js browser's viewer: "legacy" (with limitations, no annotations, no scrolling, etc..)
46
+ - Allow custom callbacks when an annotation is clicked
47
+ - Additional support showing PDF documents using the native pdf.js browser's viewer: "legacy" (with limitations, no
48
+ annotations, no scrolling, etc..)
46
49
 
47
50
  ## Limitations
51
+
48
52
  - Tested and developed to support Firefox and Chrome.
49
- - The legacy visualization works only on Firefox and does not support annotations
50
- - Our Javascript skills are limited, so all troubleshooting may take time
53
+ - The legacy visualization works only on Firefox and does not support annotations
54
+ - Our Javascript skills are limited, so all troubleshooting may take time
51
55
  - The component is still in development, so expect some bugs and limitations
52
56
  - The streamlit reload at each action may render slowly for complex PDF documents
53
57
 
54
58
  ## Caveats
55
- Here some caveats to be aware of:
56
- - It 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.
57
- - From version 0.0.16, the behavior for managing width and height has changed:
58
- - If only the height is specified, the PDF document will be shown in proportion with the with proportional based on the PDF dimensions.
59
- - The possibility to show a large view of half the PDF is not available anymore (let's face it, it was not very useful).
60
- - If you need to use all the available space and limit the height, you can encapsulate the `pdf_viewer()` into a `st.component(width:...)` setting the width.
61
- - The `legacy` rendering is not supported on Chrome, due to security reasons.
62
-
63
59
 
60
+ Here some caveats to be aware of:
61
+
62
+ - It is mandatory to specify a `width` to show PDF document on tabs and expanders, otherwise, the viewer will not be
63
+ displayed on tabs not immediately visible.
64
+ - From version 0.0.16, the behavior for managing width and height has changed:
65
+ - If only the height is specified, the PDF document will be shown in proportion with the with proportional based on
66
+ the PDF dimensions.
67
+ - The possibility to show a large view of half the PDF is not available anymore (let's face it, it was not very
68
+ useful).
69
+ - If you need to use all the available space and limit the height, you can encapsulate the `pdf_viewer()` into a
70
+ `st.component(width:...)` setting the width.
71
+ - The `legacy` rendering is not supported on Chrome, due to security reasons.
64
72
 
65
73
  ## Getting started
66
74
 
@@ -81,42 +89,49 @@ pdf_viewer("str, path or bytes")
81
89
 
82
90
  In the following table the list of parameters that can be provided to the `pdf_viewer` function:
83
91
 
84
- | name | description |
85
- |---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
86
- | input | The source of the PDF file. Accepts a file path or binary data. |
87
- | width | Width of the PDF viewer in pixels. It defaults to 700 pixels. It supports both integer (pixel, e.g. `700`) and string (percentages, e.g. `90%` will make the pdf render to 90% of the container/window/screen width. If the pdf width is larger than the screen width, it will horizontally scroll). |
88
- | height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
89
- | annotations | A list of annotations to be overlaid on the PDF. Format is described [here](#annotation-format). |
90
- | pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
91
- | annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
92
- | rendering | Type of rendering: `unwrap` (default), `legacy_iframe`, or `legacy_embed`. The default value, `unwrap` shows the PDF document using pdf.js, and supports the visualisation of annotations. Other values are `legacy_iframe` and `legacy_embed` which use the legacy approach of injecting the document into an `<embed>` or `<iframe>`. They allow viewing the PDF using the viewer of the browser that contains additional features we are still working to implement in this component. **IMPORTANT**: :warning: The "legacy" methods **work only with Firefox**, and **do not support annotations**. :warning: |
93
- | pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
94
- | render_text | Enable a layer of text on top of the PDF document. The text may be selected and copied. **NOTE** to avoid breaking existing deployments, we made this optional at first, also considering that having many annotations might interfere with the copy-paste. |
95
- | scroll_to_page | Scroll to a specific page when the component is rendered. Default is None. Require ints and ignores the parameters below zero. |
96
- | scroll_to_annotation | Scroll to a specific annotation when the component is rendered. Default is None. Mutually exclusive with `scroll_to_page`. Raise an exception if used with `scroll_to_page` |
97
- | on_annotation_click | Callback function that is called when an annotation is clicked. The function receives the annotation as a parameter. |
98
-
99
- ### Annotation format
100
- The annotations format has been derived from the [Grobid's coordinate formats](https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/), which are described as a list of "bounding boxes".
101
- The annotations are expressed as a dictionary of six elements, the page, x and y indicate the top left point. The color can be expressed following the html CSS convention.
102
-
103
- Here an example:
92
+ | name | description |
93
+ |-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
94
+ | input | The source of the PDF file. Accepts a file path or binary data. |
95
+ | width | Width of the PDF viewer in pixels. It defaults to 700 pixels. It supports both integer (pixel, e.g. `700`) and string (percentages, e.g. `90%` will make the pdf render to 90% of the container/window/screen width. If the pdf width is larger than the screen width, it will horizontally scroll). |
96
+ | height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
97
+ | annotations | A list of annotations to be overlaid on the PDF. Format is described [here](#annotation-format). |
98
+ | pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
99
+ | annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
100
+ | rendering | Type of rendering: `unwrap` (default), `legacy_iframe`, or `legacy_embed`. The default value, `unwrap` shows the PDF document using pdf.js, and supports the visualisation of annotations. Other values are `legacy_iframe` and `legacy_embed` which use the legacy approach of injecting the document into an `<embed>` or `<iframe>`. They allow viewing the PDF using the viewer of the browser that contains additional features we are still working to implement in this component. **IMPORTANT**: :warning: The "legacy" methods **work only with Firefox**, and **do not support annotations**. :warning: |
101
+ | pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
102
+ | render_text | Enable a layer of text on top of the PDF document. The text may be selected and copied. **NOTE** to avoid breaking existing deployments, we made this optional at first, also considering that having many annotations might interfere with the copy-paste. |
103
+ | scroll_to_page | Scroll to a specific page when the component is rendered. The parameter is an integer, which represent the positional value of the page. E.g. 1, will be the first page. Default is None. Require ints and ignores the parameters below zero. |
104
+ | scroll_to_annotation | Scroll to a specific annotation when the component is rendered. The parameter is an integer, which represent the positional value of the annotation. E.g. 1, will be the first annotation. Default is None (don't scroll). Mutually exclusive with `scroll_to_page`. Raise an exception if used with `scroll_to_page` |
105
+ | on_annotation_click | Callback function that is called when an annotation is clicked. The function receives the annotation as a parameter. |
106
+
107
+ ### Annotation format
108
+
109
+ The annotations format has been derived from
110
+ the [Grobid's coordinate formats](https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/), which are described as a
111
+ list of "bounding boxes".
112
+ The annotations are expressed as a dictionary of six elements, the page, x and y indicate the top left point. The color
113
+ can be expressed following the html CSS convention.
114
+
115
+ Here an example:
104
116
 
105
117
  ```json
106
118
  [
107
- {
108
- "page": 1,
109
- "x": 220,
110
- "y": 155,
111
- "height": 22,
112
- "width": 65,
113
- "color": "red",
114
- "border": "solid"
115
- },
116
- [...]
119
+ {
120
+ "page": 1,
121
+ "x": 220,
122
+ "y": 155,
123
+ "height": 22,
124
+ "width": 65,
125
+ "color": "red",
126
+ "border": "solid"
127
+ },
128
+ [
129
+ ...
130
+ ]
117
131
  ```
118
132
 
119
- The `border` parameter can be set with the following values: `solid`, `dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`. Any other value will result in the default value: `solid`.
133
+ The `border` parameter can be set with the following values: `solid`, `dashed`, `dotted`, `double`, `groove`, `ridge`,
134
+ `inset`, `outset`. Any other value will result in the default value: `solid`.
120
135
 
121
136
  The example shown in our screenshot can be found [here](resources/annotations.json).
122
137
 
@@ -145,18 +160,19 @@ annotations = [
145
160
  }
146
161
  ]
147
162
 
163
+
148
164
  def my_custom_annotation_handler(annotation):
149
165
  print(f"Annotation {annotation} clicked.")
150
166
 
167
+
151
168
  pdf_viewer(
152
- "path/to/pdf",
153
- on_annotation_click=my_custom_annotation_handler,
154
- annotations=annotations
169
+ "path/to/pdf",
170
+ on_annotation_click=my_custom_annotation_handler,
171
+ annotations=annotations
155
172
  )
156
173
 
157
174
  ```
158
175
 
159
-
160
176
  ## Developers notes
161
177
 
162
178
  ### Environment
@@ -167,7 +183,8 @@ pdf_viewer(
167
183
 
168
184
  ### Configure environment for development
169
185
 
170
- First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode, use the following commands:
186
+ First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode,
187
+ use the following commands:
171
188
 
172
189
  ```shell
173
190
  streamlit run streamlit_pdf_viewer/__init__.py
@@ -176,7 +193,8 @@ cd frontend
176
193
  npm run serve
177
194
  ```
178
195
 
179
- These commands will start the Streamlit application and serve the Node.js component. Please make sure you're in the correct directory before running these commands.
196
+ These commands will start the Streamlit application and serve the Node.js component. Please make sure you're in the
197
+ correct directory before running these commands.
180
198
 
181
199
  ### Integrate into a streamlit application
182
200
 
@@ -7,11 +7,13 @@
7
7
  # streamlit-pdf-viewer
8
8
 
9
9
  Streamlit component that allows the visualisation and enrichment of PDF documents.
10
- You can see an [application](https://github.com/lfoppiano/structure-vision) in action [here](https://structure-vision.streamlit.app/).
10
+ You can see an [application](https://github.com/lfoppiano/structure-vision) in
11
+ action [here](https://structure-vision.streamlit.app/).
11
12
 
12
13
  <img src="https://github.com/lfoppiano/streamlit-pdf-viewer/raw/main/docs/screenshot.png" width=500 align="right" />
13
14
 
14
15
  ## Features
16
+
15
17
  - Show PDF files in a Streamlit application with a simple command
16
18
  - Based on the pdf.js library
17
19
  - Visualize annotations on top of the PDF documents
@@ -19,26 +21,32 @@ You can see an [application](https://github.com/lfoppiano/structure-vision) in a
19
21
  - Allow to render specific pages of the PDF document
20
22
  - Scroll to a specific page
21
23
  - Scroll to a specific annotation
22
- - Allow custom callbacks when an annotation is clicked
23
- - Additional support showing PDF documents using the native pdf.js browser's viewer: "legacy" (with limitations, no annotations, no scrolling, etc..)
24
+ - Allow custom callbacks when an annotation is clicked
25
+ - Additional support showing PDF documents using the native pdf.js browser's viewer: "legacy" (with limitations, no
26
+ annotations, no scrolling, etc..)
24
27
 
25
28
  ## Limitations
29
+
26
30
  - Tested and developed to support Firefox and Chrome.
27
- - The legacy visualization works only on Firefox and does not support annotations
28
- - Our Javascript skills are limited, so all troubleshooting may take time
31
+ - The legacy visualization works only on Firefox and does not support annotations
32
+ - Our Javascript skills are limited, so all troubleshooting may take time
29
33
  - The component is still in development, so expect some bugs and limitations
30
34
  - The streamlit reload at each action may render slowly for complex PDF documents
31
35
 
32
36
  ## Caveats
33
- Here some caveats to be aware of:
34
- - It 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.
35
- - From version 0.0.16, the behavior for managing width and height has changed:
36
- - If only the height is specified, the PDF document will be shown in proportion with the with proportional based on the PDF dimensions.
37
- - The possibility to show a large view of half the PDF is not available anymore (let's face it, it was not very useful).
38
- - If you need to use all the available space and limit the height, you can encapsulate the `pdf_viewer()` into a `st.component(width:...)` setting the width.
39
- - The `legacy` rendering is not supported on Chrome, due to security reasons.
40
-
41
37
 
38
+ Here some caveats to be aware of:
39
+
40
+ - It is mandatory to specify a `width` to show PDF document on tabs and expanders, otherwise, the viewer will not be
41
+ displayed on tabs not immediately visible.
42
+ - From version 0.0.16, the behavior for managing width and height has changed:
43
+ - If only the height is specified, the PDF document will be shown in proportion with the with proportional based on
44
+ the PDF dimensions.
45
+ - The possibility to show a large view of half the PDF is not available anymore (let's face it, it was not very
46
+ useful).
47
+ - If you need to use all the available space and limit the height, you can encapsulate the `pdf_viewer()` into a
48
+ `st.component(width:...)` setting the width.
49
+ - The `legacy` rendering is not supported on Chrome, due to security reasons.
42
50
 
43
51
  ## Getting started
44
52
 
@@ -59,42 +67,49 @@ pdf_viewer("str, path or bytes")
59
67
 
60
68
  In the following table the list of parameters that can be provided to the `pdf_viewer` function:
61
69
 
62
- | name | description |
63
- |---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
64
- | input | The source of the PDF file. Accepts a file path or binary data. |
65
- | width | Width of the PDF viewer in pixels. It defaults to 700 pixels. It supports both integer (pixel, e.g. `700`) and string (percentages, e.g. `90%` will make the pdf render to 90% of the container/window/screen width. If the pdf width is larger than the screen width, it will horizontally scroll). |
66
- | height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
67
- | annotations | A list of annotations to be overlaid on the PDF. Format is described [here](#annotation-format). |
68
- | pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
69
- | annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
70
- | rendering | Type of rendering: `unwrap` (default), `legacy_iframe`, or `legacy_embed`. The default value, `unwrap` shows the PDF document using pdf.js, and supports the visualisation of annotations. Other values are `legacy_iframe` and `legacy_embed` which use the legacy approach of injecting the document into an `<embed>` or `<iframe>`. They allow viewing the PDF using the viewer of the browser that contains additional features we are still working to implement in this component. **IMPORTANT**: :warning: The "legacy" methods **work only with Firefox**, and **do not support annotations**. :warning: |
71
- | pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
72
- | render_text | Enable a layer of text on top of the PDF document. The text may be selected and copied. **NOTE** to avoid breaking existing deployments, we made this optional at first, also considering that having many annotations might interfere with the copy-paste. |
73
- | scroll_to_page | Scroll to a specific page when the component is rendered. Default is None. Require ints and ignores the parameters below zero. |
74
- | scroll_to_annotation | Scroll to a specific annotation when the component is rendered. Default is None. Mutually exclusive with `scroll_to_page`. Raise an exception if used with `scroll_to_page` |
75
- | on_annotation_click | Callback function that is called when an annotation is clicked. The function receives the annotation as a parameter. |
76
-
77
- ### Annotation format
78
- The annotations format has been derived from the [Grobid's coordinate formats](https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/), which are described as a list of "bounding boxes".
79
- The annotations are expressed as a dictionary of six elements, the page, x and y indicate the top left point. The color can be expressed following the html CSS convention.
80
-
81
- Here an example:
70
+ | name | description |
71
+ |-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
72
+ | input | The source of the PDF file. Accepts a file path or binary data. |
73
+ | width | Width of the PDF viewer in pixels. It defaults to 700 pixels. It supports both integer (pixel, e.g. `700`) and string (percentages, e.g. `90%` will make the pdf render to 90% of the container/window/screen width. If the pdf width is larger than the screen width, it will horizontally scroll). |
74
+ | height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
75
+ | annotations | A list of annotations to be overlaid on the PDF. Format is described [here](#annotation-format). |
76
+ | pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
77
+ | annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
78
+ | rendering | Type of rendering: `unwrap` (default), `legacy_iframe`, or `legacy_embed`. The default value, `unwrap` shows the PDF document using pdf.js, and supports the visualisation of annotations. Other values are `legacy_iframe` and `legacy_embed` which use the legacy approach of injecting the document into an `<embed>` or `<iframe>`. They allow viewing the PDF using the viewer of the browser that contains additional features we are still working to implement in this component. **IMPORTANT**: :warning: The "legacy" methods **work only with Firefox**, and **do not support annotations**. :warning: |
79
+ | pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
80
+ | render_text | Enable a layer of text on top of the PDF document. The text may be selected and copied. **NOTE** to avoid breaking existing deployments, we made this optional at first, also considering that having many annotations might interfere with the copy-paste. |
81
+ | scroll_to_page | Scroll to a specific page when the component is rendered. The parameter is an integer, which represent the positional value of the page. E.g. 1, will be the first page. Default is None. Require ints and ignores the parameters below zero. |
82
+ | scroll_to_annotation | Scroll to a specific annotation when the component is rendered. The parameter is an integer, which represent the positional value of the annotation. E.g. 1, will be the first annotation. Default is None (don't scroll). Mutually exclusive with `scroll_to_page`. Raise an exception if used with `scroll_to_page` |
83
+ | on_annotation_click | Callback function that is called when an annotation is clicked. The function receives the annotation as a parameter. |
84
+
85
+ ### Annotation format
86
+
87
+ The annotations format has been derived from
88
+ the [Grobid's coordinate formats](https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/), which are described as a
89
+ list of "bounding boxes".
90
+ The annotations are expressed as a dictionary of six elements, the page, x and y indicate the top left point. The color
91
+ can be expressed following the html CSS convention.
92
+
93
+ Here an example:
82
94
 
83
95
  ```json
84
96
  [
85
- {
86
- "page": 1,
87
- "x": 220,
88
- "y": 155,
89
- "height": 22,
90
- "width": 65,
91
- "color": "red",
92
- "border": "solid"
93
- },
94
- [...]
97
+ {
98
+ "page": 1,
99
+ "x": 220,
100
+ "y": 155,
101
+ "height": 22,
102
+ "width": 65,
103
+ "color": "red",
104
+ "border": "solid"
105
+ },
106
+ [
107
+ ...
108
+ ]
95
109
  ```
96
110
 
97
- The `border` parameter can be set with the following values: `solid`, `dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`. Any other value will result in the default value: `solid`.
111
+ The `border` parameter can be set with the following values: `solid`, `dashed`, `dotted`, `double`, `groove`, `ridge`,
112
+ `inset`, `outset`. Any other value will result in the default value: `solid`.
98
113
 
99
114
  The example shown in our screenshot can be found [here](resources/annotations.json).
100
115
 
@@ -123,18 +138,19 @@ annotations = [
123
138
  }
124
139
  ]
125
140
 
141
+
126
142
  def my_custom_annotation_handler(annotation):
127
143
  print(f"Annotation {annotation} clicked.")
128
144
 
145
+
129
146
  pdf_viewer(
130
- "path/to/pdf",
131
- on_annotation_click=my_custom_annotation_handler,
132
- annotations=annotations
147
+ "path/to/pdf",
148
+ on_annotation_click=my_custom_annotation_handler,
149
+ annotations=annotations
133
150
  )
134
151
 
135
152
  ```
136
153
 
137
-
138
154
  ## Developers notes
139
155
 
140
156
  ### Environment
@@ -145,7 +161,8 @@ pdf_viewer(
145
161
 
146
162
  ### Configure environment for development
147
163
 
148
- First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode, use the following commands:
164
+ First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode,
165
+ use the following commands:
149
166
 
150
167
  ```shell
151
168
  streamlit run streamlit_pdf_viewer/__init__.py
@@ -154,7 +171,8 @@ cd frontend
154
171
  npm run serve
155
172
  ```
156
173
 
157
- These commands will start the Streamlit application and serve the Node.js component. Please make sure you're in the correct directory before running these commands.
174
+ These commands will start the Streamlit application and serve the Node.js component. Please make sure you're in the
175
+ correct directory before running these commands.
158
176
 
159
177
  ### Integrate into a streamlit application
160
178
 
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>streamlit_pdf_viewer</title><script defer="defer" src="js/chunk-vendors.a7b421ed.js"></script><script defer="defer" src="js/app.3d9d09f3.js"></script><link href="css/chunk-vendors.ee6905b7.css" rel="stylesheet"><link href="css/app.1df382f3.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but streamlit_pdf_viewer doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>streamlit_pdf_viewer</title><script defer="defer" src="js/chunk-vendors.a7b421ed.js"></script><script defer="defer" src="js/app.91327107.js"></script><link href="css/chunk-vendors.ee6905b7.css" rel="stylesheet"><link href="css/app.1df382f3.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but streamlit_pdf_viewer doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
@@ -0,0 +1,2 @@
1
+ (()=>{"use strict";var e={711:(e,t,n)=>{var r=n(3751),i=n(641);const a={id:"app"};function o(e,t,n,r,o,s){const l=(0,i.g2)("PdfViewer"),d=(0,i.g2)("WithStreamlitConnection");return(0,i.uX)(),(0,i.CE)("div",a,[(0,i.bF)(d,null,{default:(0,i.k6)((({args:e})=>[(0,i.bF)(l,{args:e},null,8,["args"])])),_:1})])}var s=n(33);const l={key:0},d={key:1},c=["src","width","height"],p={key:2},h=["src","width","height"],g={key:3};function u(e,t,n,r,a,o){return(0,i.uX)(),(0,i.CE)("div",{id:"pdfContainer",style:(0,s.Tr)(r.pdfContainerStyle)},["unwrap"===n.args.rendering?((0,i.uX)(),(0,i.CE)("div",l,[(0,i.Lk)("div",{id:"pdfViewer",style:(0,s.Tr)(r.pdfViewerStyle)},null,4)])):"legacy_embed"===n.args.rendering?((0,i.uX)(),(0,i.CE)("div",d,[(0,i.Lk)("embed",{src:`data:application/pdf;base64,${n.args.binary}`,width:`${n.args.width}`,height:`${n.args.height}`,type:"application/pdf"},null,8,c)])):"legacy_iframe"===n.args.rendering?((0,i.uX)(),(0,i.CE)("div",p,[(0,i.Lk)("embed",{src:`data:application/pdf;base64,${n.args.binary}`,width:`${n.args.width}`,height:`${n.args.height}`,type:"application/pdf"},null,8,h)])):((0,i.uX)(),(0,i.CE)("div",g," Error rendering option. "))],4)}n(4114),n(8111),n(2489),n(7588);var v=n(953),w=(n(951),n(9936)),y=n(7445),f=n(2543);const m="pdfjs-dist/cmaps/",b=!0,_=!0,E=["solid","dashed","dotted","double","groove","ridge","inset","outset","none",void 0,null],x={props:["args"],setup(e){const t=(0,v.KR)(0),n=(0,v.KR)(0),r=(0,v.KR)([]),a=(0,v.KR)([]),o=(0,v.KR)([]),s=(0,v.KR)(e.args.height||0),l=(e.args.pages_to_render.length,!0===e.args.render_text),d=(e,t=window.innerWidth)=>{if("string"===typeof e&&e.endsWith("%")){const t=parseFloat(e);if(!isNaN(t))return{type:"percent",value:t/100}}const n=Number(e);return!isNaN(n)&&n>0?{type:"pixel",value:n}:{type:"pixel",value:t}},c=(0,i.EW)((()=>{const t=d(e.args.width,window.innerWidth),n="percent"===t.type?100*t.value+"%":`${t.value}px`;return{width:n,height:e.args.height?`${e.args.height}px`:"auto",overflow:"auto",position:"relative"}})),p={position:"relative"},h=e=>{e&&(e.innerHTML="")},g=(t,n,r,i,a=1)=>{const o=t.getViewport({scale:n,rotation:r}),s=(window.devicePixelRatio||1)*a,l=document.createElement("canvas");return l.id=`canvas_page_${i}`,l.height=o.height*s+e.args.pages_vertical_spacing,l.width=o.width*s,l.style.width=`${o.width}px`,l.style.height=`${o.height}px`,l.style.display="block",l.style.marginBottom=`${e.args.pages_vertical_spacing}px`,l.getContext("2d").scale(s,s),l},u=(t,n,r,i)=>{const a=document.createElement("div");t.id=`${t.id||n}`,a.id=`annotation-${t.id}`,a.setAttribute("data-index",t.id),a.style.position="absolute",a.style.left=t.x*i+"px",a.style.top=t.y*i+"px",a.style.width=t.width*i+"px",a.style.height=t.height*i+"px";let o=t.border;t.border&&E.includes(t.border)||(o="solid"),a.style.outline=`${e.args.annotation_outline_size*i}px ${o} ${t.color}`,a.style.cursor=l?"text":"pointer",a.style.pointerEvents=l?"none":"auto",a.style.zIndex=10,l||a.addEventListener("click",(()=>{y.wk.setComponentValue({clicked_annotation:{index:t.id,...t}})})),r.appendChild(a)},x=async(e,t,n,r,i)=>{const a={canvasContext:t.getContext("2d"),viewport:n};await e.render(a).promise;const o=document.createElement("div");o.className="page",o.style.position="relative",o.style.width=`${n.width}px`,o.style.height=`${n.height}px`;const s=document.createElement("div");if(s.className="canvasWrapper",s.style.position="absolute",s.style.top="0",s.style.left="0",s.appendChild(t),o.appendChild(s),l){const t=await e.getTextContent(),r=document.createElement("div");r.className="textLayer",r.style.zIndex="11",r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.height=`${n.height}px`,r.style.width=`${n.width}px`;const i=new w.D6({textContentSource:t,container:r,viewport:n,textDivs:[]});await i.render(),o.appendChild(r)}r&&r.length>0&&r.forEach(((e,t)=>{const r=i+t;u(e,r,o,n.scale)}));const d=document.getElementById("pdfViewer");d.appendChild(o)},k=t=>0===e.args.pages_to_render.length?Array.from({length:t},((e,t)=>t+1)):e.args.pages_to_render,C=async(i,s,l)=>{t.value=0,r.value=[],a.value=[],o.value=[];const d=e.args.resolution_boost||1;let c=0;for(let p=1;p<=i.numPages;p++){const h=await i.getPage(p),u=h.rotate,v=h.getViewport({scale:1,rotation:u});if(e.args.height>0){const t=v.width/v.height,r=t*e.args.height;(0===n.value||r<n.value)&&(n.value=r)}const w=n.value/v.width;if(r.value.push(w),a.value.push(v.height),l.includes(p)){const n=g(h,w,u,p,d);s.style.setProperty("--scale-factor",w);const r=h.getViewport({scale:w,rotation:u,intent:"print"}),i=e.args.annotations.filter((e=>Number(e.page)===p));t.value+=n.height/((window.devicePixelRatio||1)*d),await x(h,n,r,i,c),c+=i.length,n.id&&o.value.push(n.id)}}l.length>0&&(t.value-=e.args.pages_vertical_spacing)},$=e=>{console.error(e),window.alert(e.message)},R=async e=>{w.EA.workerSrc="pdfjs-dist/build/pdf.worker.mjs";try{const t=(0,w.YE)({url:e,cMapUrl:m,cMapPacked:b,enableXfa:_}),n=await t.promise,r=document.getElementById("pdfViewer");h(r);const i=k(n.numPages);await C(n,r,i),V()}catch(t){$(t)}},V=()=>{if(e.args.scroll_to_page){const t=document.getElementById(`canvas_page_${e.args.scroll_to_page}`);t&&t.scrollIntoView({behavior:"smooth"})}else if(e.args.scroll_to_annotation){const t=document.querySelector(`[id^="annotation-"][data-index="${e.args.scroll_to_annotation}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"center"})}},N=()=>{const n=e.args.height||t.value;n!==s.value&&(y.wk.setFrameHeight(n),s.value=n)},L=()=>{const t=d(e.args.width,window.innerWidth);let r;r="percent"===t.type?Math.min(Math.floor(t.value*window.innerWidth),window.innerWidth):Math.min(t.value,window.innerWidth),r!==n.value&&(n.value=r)},W=async()=>{try{if(console.log("handleResize"),"unwrap"===e.args.rendering){const t=`data:application/pdf;base64,${e.args.binary}`;L(),await R(t),N()}}catch(t){console.error(t)}},O=(0,f.debounce)(W,200);return(0,i.sV)((()=>{O(),window.addEventListener("resize",O)})),(0,i.hi)((()=>{window.removeEventListener("resize",O)})),{pdfContainerStyle:c,pdfViewerStyle:p}}};var k=n(6262);const C=(0,k.A)(x,[["render",u]]),$=C,R={key:0},V={class:"err__msg"};function N(e,t,n,r,a,o){return(0,i.uX)(),(0,i.CE)("div",null,[""!=e.componentError?((0,i.uX)(),(0,i.CE)("div",R,[t[0]||(t[0]=(0,i.Lk)("h1",{class:"err__title"},"Component Error",-1)),(0,i.Lk)("div",V,"Message: "+(0,s.v_)(e.componentError),1)])):null!=e.renderData?(0,i.RG)(e.$slots,"default",{key:1,args:e.renderData.args,disabled:e.renderData.disabled},void 0,!0):(0,i.Q3)("",!0)])}const L=(0,i.pM)({name:"WithStreamlitConnection",setup(){const e=(0,v.KR)(void 0),t=(0,v.KR)(""),n=n=>{const r=n;e.value=r.detail,t.value=""};return(0,i.sV)((()=>{y.wk.events.addEventListener(y.wk.RENDER_EVENT,n),y.wk.setComponentReady()})),(0,i.$u)((()=>{""!=t.value&&y.wk.setFrameHeight()})),(0,i.hi)((()=>{y.wk.events.removeEventListener(y.wk.RENDER_EVENT,n)})),(0,i.qG)((e=>{t.value=String(e)})),{renderData:e,componentError:t}}}),W=(0,k.A)(L,[["render",N],["__scopeId","data-v-bef81972"]]),O=W,P=(0,i.pM)({name:"App",components:{PdfViewer:$,WithStreamlitConnection:O}}),S=(0,k.A)(P,[["render",o]]),j=S;(0,r.Ef)(j).mount("#app")}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var a=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(a.exports,a,a.exports,n),a.loaded=!0,a.exports}n.m=e,(()=>{var e=[];n.O=(t,r,i,a)=>{if(!r){var o=1/0;for(c=0;c<e.length;c++){for(var[r,i,a]=e[c],s=!0,l=0;l<r.length;l++)(!1&a||o>=a)&&Object.keys(n.O).every((e=>n.O[e](r[l])))?r.splice(l--,1):(s=!1,a<o&&(o=a));if(s){e.splice(c--,1);var d=i();void 0!==d&&(t=d)}}return t}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[r,i,a]}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e)})(),(()=>{var e={524:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var i,a,[o,s,l]=r,d=0;if(o.some((t=>0!==e[t]))){for(i in s)n.o(s,i)&&(n.m[i]=s[i]);if(l)var c=l(n)}for(t&&t(r);d<o.length;d++)a=o[d],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(c)},r=self["webpackChunkstreamlit_pdf_viewer"]=self["webpackChunkstreamlit_pdf_viewer"]||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var r=n.O(void 0,[504],(()=>n(711)));r=n.O(r)})();
2
+ //# sourceMappingURL=app.91327107.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js/app.91327107.js","mappings":"+DAEA,MAAMA,EAAa,CCIZC,GAAG,ODFJ,SAAUC,EAAOC,EAAUC,EAAYC,EAAYC,EAAYC,EAAWC,GAC9E,MAAMC,GAAuBC,EAAAA,EAAAA,IAAkB,aACzCC,GAAqCD,EAAAA,EAAAA,IAAkB,2BAE7D,OAAQE,EAAAA,EAAAA,OCFRC,EAAAA,EAAAA,IAIM,MAJNb,EAIM,EAHJc,EAAAA,EAAAA,IAE0BH,EAAA,MAT9BI,SAAAC,EAAAA,EAAAA,KAQM,EADiCC,UAAI,EACrCH,EAAAA,EAAAA,IAA0BL,EAAA,CAAdQ,KAAMA,GAAI,oBAR5BC,EAAA,KDgBA,C,qBEhBAC,IAAA,G,GAAAA,IAAA,G,EAAA,yB,GAAAA,IAAA,G,EAAA,yB,GAAAA,IAAA,G,0CACEN,EAAAA,EAAAA,IAeM,OAfDZ,GAAG,eAAgBmB,OAD1BC,EAAAA,EAAAA,IACiCf,EAAAgB,oB,CACC,WAAnBjB,EAAAY,KAAKM,YAAS,WAAzBV,EAAAA,EAAAA,IAEM,MAJVb,EAAA,EAGMwB,EAAAA,EAAAA,IAAkD,OAA7CvB,GAAG,YAAamB,OAH3BC,EAAAA,EAAAA,IAGkCf,EAAAmB,iB,WAEK,iBAAnBpB,EAAAY,KAAKM,YAAS,WAA9BV,EAAAA,EAAAA,IAGM,MARVa,EAAA,EAMMF,EAAAA,EAAAA,IAC+B,SADvBG,IAAG,+BAAiCtB,EAAAY,KAAKW,SAAWC,MAAK,GAAKxB,EAAAY,KAAKY,QAAUC,OAAM,GAAKzB,EAAAY,KAAKa,SAC9FC,KAAK,mB,OAPlBC,MASu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EAAS,IAAIxM,EAASwM,EAAQ/C,EAClC,CAEA,IADG4C,GAA4BA,EAA2BC,GACrD9H,EAAI4F,EAASnL,OAAQuF,IACzB2H,EAAU/B,EAAS5F,GAChBiF,EAAoByB,EAAEgB,EAAiBC,IAAYD,EAAgBC,IACrED,EAAgBC,GAAS,KAE1BD,EAAgBC,GAAW,EAE5B,OAAO1C,EAAoBU,EAAEnK,EAAO,EAGjC0M,EAAqBC,KAAK,oCAAsCA,KAAK,qCAAuC,GAChHD,EAAmBzI,QAAQmI,EAAqBQ,KAAK,KAAM,IAC3DF,EAAmBvH,KAAOiH,EAAqBQ,KAAK,KAAMF,EAAmBvH,KAAKyH,KAAKF,G,KC7CvF,IAAIG,EAAsBpD,EAAoBU,OAAE9L,EAAW,CAAC,MAAM,IAAOoL,EAAoB,OAC7FoD,EAAsBpD,EAAoBU,EAAE0C,E","sources":["webpack://streamlit_pdf_viewer/./src/App.vue?9ab1","webpack://streamlit_pdf_viewer/./src/App.vue","webpack://streamlit_pdf_viewer/./src/PdfViewer.vue","webpack://streamlit_pdf_viewer/./src/PdfViewer.vue?f557","webpack://streamlit_pdf_viewer/./src/streamlit/WithStreamlitConnection.vue?8d46","webpack://streamlit_pdf_viewer/./src/streamlit/WithStreamlitConnection.vue","webpack://streamlit_pdf_viewer/./src/streamlit/WithStreamlitConnection.vue?1dfc","webpack://streamlit_pdf_viewer/./src/App.vue?7ccd","webpack://streamlit_pdf_viewer/./src/main.ts","webpack://streamlit_pdf_viewer/webpack/bootstrap","webpack://streamlit_pdf_viewer/webpack/runtime/chunk loaded","webpack://streamlit_pdf_viewer/webpack/runtime/define property getters","webpack://streamlit_pdf_viewer/webpack/runtime/global","webpack://streamlit_pdf_viewer/webpack/runtime/hasOwnProperty shorthand","webpack://streamlit_pdf_viewer/webpack/runtime/node module decorator","webpack://streamlit_pdf_viewer/webpack/runtime/jsonp chunk loading","webpack://streamlit_pdf_viewer/webpack/startup"],"sourcesContent":["import { resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { id: \"app\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_PdfViewer = _resolveComponent(\"PdfViewer\")!\n const _component_WithStreamlitConnection = _resolveComponent(\"WithStreamlitConnection\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(_component_WithStreamlitConnection, null, {\n default: _withCtx(({ args }) => [\n _createVNode(_component_PdfViewer, { args: args }, null, 8, [\"args\"])\n ]),\n _: 1\n })\n ]))\n}","<!-- \n We bootstrap our Component to Streamlit with our scoped slot in the top-level App.\n This is where scoped slot passes Streamlit `args` data from itself to children MyComponent.\n You should not have to edit this, but are free to do so :)\n-->\n<template>\n <div id=\"app\">\n <WithStreamlitConnection v-slot=\"{ args }\">\n <PdfViewer :args=\"args\" />\n </WithStreamlitConnection>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from \"vue\"\nimport PdfViewer from \"./PdfViewer.vue\"\n\n// \"withStreamlitConnection\" is a scoped slot. It bootstraps the\n// connection between your component and the Streamlit app, and handles\n// passing arguments from Python -> Component.\n//\n// You don't need to edit withStreamlitConnection (but you're welcome to!).\nimport WithStreamlitConnection from \"./streamlit/WithStreamlitConnection.vue\"\n\nexport default defineComponent({\n name: \"App\",\n components: {\n PdfViewer,\n WithStreamlitConnection,\n },\n})\n</script>\n\n<style>\nbody {\n margin: 0;\n}\n#app {\n font-family: Avenir, Helvetica, Arial, sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n color: #2c3e50;\n}\n</style>\n","<template>\n <div id=\"pdfContainer\" :style=\"pdfContainerStyle\">\n <div v-if=\"args.rendering === 'unwrap'\">\n <div id=\"pdfViewer\" :style=\"pdfViewerStyle\"></div>\n </div>\n <div v-else-if=\"args.rendering === 'legacy_embed'\">\n <embed :src=\"`data:application/pdf;base64,${args.binary}`\" :width=\"`${args.width}`\" :height=\"`${args.height}`\"\n type=\"application/pdf\"/>\n </div>\n <div v-else-if=\"args.rendering === 'legacy_iframe'\">\n <embed :src=\"`data:application/pdf;base64,${args.binary}`\" :width=\"`${args.width}`\" :height=\"`${args.height}`\"\n type=\"application/pdf\"/>\n </div>\n <div v-else>\n Error rendering option.\n </div>\n </div>\n</template>\n\n<script>\nimport { onMounted, onUpdated, computed, ref, onUnmounted } from \"vue\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport \"pdfjs-dist/build/pdf.worker.mjs\";\nimport { getDocument } from \"pdfjs-dist/build/pdf\";\nimport { Streamlit } from \"streamlit-component-lib\";\nimport * as pdfjsLib from \"pdfjs-dist\";\nimport { debounce } from 'lodash';\n\nconst CMAP_URL = \"pdfjs-dist/cmaps/\";\nconst CMAP_PACKED = true;\nconst ENABLE_XFA = true;\nconst acceptedBorderStyleAttributes = ['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'inset', 'outset', 'none', undefined, null];\n\nexport default {\n props: [\"args\"],\n\n setup(props) {\n const totalHeight = ref(0);\n const maxWidth = ref(0);\n const pageScales = ref([]);\n const pageHeights = ref([]);\n const loadedPages = ref([]);\n const currentFrameHeight = ref(props.args.height || 0);\n\n const isRenderingAllPages = props.args.pages_to_render.length === 0;\n\n const renderText = props.args.render_text === true;\n\n const parseWidthValue = (widthValue, fallbackValue = window.innerWidth) => {\n if (typeof widthValue === \"string\" && widthValue.endsWith(\"%\")) {\n const num = parseFloat(widthValue)\n if (!isNaN(num)) {\n return { type: \"percent\", value: num / 100 }\n }\n }\n const numeric = Number(widthValue)\n if (!isNaN(numeric) && numeric > 0) {\n return { type: \"pixel\", value: numeric }\n }\n return { type: \"pixel\", value: fallbackValue }\n }\n\n const pdfContainerStyle = computed(() => {\n const result = parseWidthValue(props.args.width, window.innerWidth);\n const widthCSS = result.type === \"percent\" ? `${result.value * 100}%` : `${result.value}px`;\n return {\n width: widthCSS,\n height: props.args.height ? `${props.args.height}px` : 'auto',\n overflow: 'auto',\n position: 'relative',\n };\n });\n\n const pdfViewerStyle = { position: 'relative' };\n\n const calculatePdfsHeight = (page) => {\n let height = 0;\n if (isRenderingAllPages) {\n for (let i = 0; i < page - 1; i++) {\n height += pageHeights.value[i] * pageScales.value[i] + props.args.pages_vertical_spacing;\n }\n } else {\n for (let i = 0; i < pageHeights.value.length; i++) {\n if (props.args.pages_to_render.includes(i + 1) && i < page - 1) {\n height += pageHeights.value[i] * pageScales.value[i] + props.args.pages_vertical_spacing;\n }\n }\n }\n return height;\n };\n\n const clearExistingCanvases = (pdfViewer) => {\n if (!pdfViewer) return;\n pdfViewer.innerHTML = '';\n };\n\n const createCanvasForPage = (page, scale, rotation, pageNumber, resolutionRatioBoost = 1) => {\n const viewport = page.getViewport({ scale, rotation });\n const ratio = (window.devicePixelRatio || 1) * resolutionRatioBoost;\n\n const canvas = document.createElement(\"canvas\");\n canvas.id = `canvas_page_${pageNumber}`;\n canvas.height = viewport.height * ratio + props.args.pages_vertical_spacing;\n canvas.width = viewport.width * ratio;\n canvas.style.width = `${viewport.width}px`;\n canvas.style.height = `${viewport.height}px`;\n canvas.style.display = \"block\";\n canvas.style.marginBottom = `${props.args.pages_vertical_spacing}px`;\n canvas.getContext(\"2d\").scale(ratio, ratio);\n\n return canvas;\n };\n\n const renderAnnotation = (annotation, annotationIndex, pageDiv, scale) => {\n const annotationDiv = document.createElement('div');\n annotation.id = `${annotation.id || annotationIndex}`\n annotationDiv.id = `annotation-${annotation.id}`;\n annotationDiv.setAttribute(\"data-index\", annotation.id);\n annotationDiv.style.position = 'absolute';\n annotationDiv.style.left = `${annotation.x * scale}px`;\n annotationDiv.style.top = `${annotation.y * scale}px`;\n annotationDiv.style.width = `${annotation.width * scale}px`;\n annotationDiv.style.height = `${annotation.height * scale}px`;\n let border = annotation.border\n if (!annotation.border || !acceptedBorderStyleAttributes.includes(annotation.border)) {\n border = \"solid\"\n }\n annotationDiv.style.outline = `${props.args.annotation_outline_size * scale}px ${border} ${annotation.color}`;\n annotationDiv.style.cursor = renderText ? 'text' : 'pointer';\n annotationDiv.style.pointerEvents = renderText ? 'none' : 'auto';\n annotationDiv.style.zIndex = 10;\n\n if (!renderText) {\n annotationDiv.addEventListener('click', () => {\n Streamlit.setComponentValue({\n clicked_annotation: { index: annotation.id, ...annotation },\n });\n });\n }\n\n pageDiv.appendChild(annotationDiv);\n };\n\n const renderPage = async (page, canvas, viewport, annotations, annotationCount) => {\n const renderContext = {\n canvasContext: canvas.getContext(\"2d\"),\n viewport: viewport\n };\n\n await page.render(renderContext).promise;\n\n const pageDiv = document.createElement('div');\n pageDiv.className = 'page';\n pageDiv.style.position = 'relative';\n pageDiv.style.width = `${viewport.width}px`;\n pageDiv.style.height = `${viewport.height}px`;\n\n const canvasWrapper = document.createElement('div');\n canvasWrapper.className = 'canvasWrapper';\n canvasWrapper.style.position = 'absolute';\n canvasWrapper.style.top = '0';\n canvasWrapper.style.left = '0';\n canvasWrapper.appendChild(canvas);\n\n pageDiv.appendChild(canvasWrapper);\n\n if (renderText) {\n const textContent = await page.getTextContent();\n const textLayerDiv = document.createElement(\"div\");\n textLayerDiv.className = \"textLayer\";\n textLayerDiv.style.zIndex = \"11\";\n textLayerDiv.style.position = 'absolute';\n textLayerDiv.style.top = '0';\n textLayerDiv.style.left = '0';\n textLayerDiv.style.height = `${viewport.height}px`;\n textLayerDiv.style.width = `${viewport.width}px`;\n\n const textLayer = new pdfjsLib.TextLayer({\n textContentSource: textContent,\n container: textLayerDiv,\n viewport: viewport,\n textDivs: []\n });\n await textLayer.render();\n\n pageDiv.appendChild(textLayerDiv);\n }\n\n if (annotations && annotations.length > 0) {\n annotations.forEach((annotation, index) => {\n const annotationUniqueIndex = annotationCount + index\n renderAnnotation(annotation, annotationUniqueIndex, pageDiv, viewport.scale);\n });\n }\n\n const pdfViewer = document.getElementById(\"pdfViewer\");\n pdfViewer.appendChild(pageDiv);\n };\n\n const getPagesToRender = (numPages) => {\n if (props.args.pages_to_render.length === 0) {\n return Array.from({ length: numPages }, (_, i) => i + 1);\n }\n return props.args.pages_to_render;\n };\n\n const renderPdfPages = async (pdf, pdfViewer, pagesToRender) => {\n totalHeight.value = 0;\n pageScales.value = [];\n pageHeights.value = [];\n loadedPages.value = [];\n\n const resolutionBoost = props.args.resolution_boost || 1;\n\n let annotationCount = 0;\n\n for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {\n const page = await pdf.getPage(pageNumber);\n const rotation = page.rotate;\n const unscaledViewport = page.getViewport({ scale: 1.0, rotation });\n\n if (props.args.height > 0) {\n const widthScale = unscaledViewport.width / unscaledViewport.height;\n const possibleScaledWidth = widthScale * props.args.height;\n if (maxWidth.value === 0 || possibleScaledWidth < maxWidth.value) {\n maxWidth.value = possibleScaledWidth;\n }\n }\n\n const scale = maxWidth.value / unscaledViewport.width;\n\n pageScales.value.push(scale);\n pageHeights.value.push(unscaledViewport.height);\n\n if (pagesToRender.includes(pageNumber)) {\n const canvas = createCanvasForPage(page, scale, rotation, pageNumber, resolutionBoost);\n pdfViewer.style.setProperty('--scale-factor', scale);\n\n const viewport = page.getViewport({\n scale: scale,\n rotation: rotation,\n intent: \"print\",\n });\n\n const annotationsForPage = props.args.annotations.filter(\n anno => Number(anno.page) === pageNumber\n );\n\n totalHeight.value += canvas.height / ((window.devicePixelRatio || 1) * resolutionBoost);\n await renderPage(page, canvas, viewport, annotationsForPage, annotationCount);\n annotationCount += annotationsForPage.length\n\n if (canvas.id) {\n loadedPages.value.push(canvas.id);\n }\n }\n }\n // Subtract the margin for the last page as it's not needed\n if (pagesToRender.length > 0) {\n totalHeight.value -= props.args.pages_vertical_spacing;\n }\n };\n\n const alertError = (error) => {\n console.error(error);\n window.alert(error.message);\n };\n\n const loadPdfs = async (url) => {\n pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker.mjs';\n try {\n const loadingTask = getDocument({\n url: url,\n cMapUrl: CMAP_URL,\n cMapPacked: CMAP_PACKED,\n enableXfa: ENABLE_XFA,\n });\n const pdf = await loadingTask.promise;\n\n const pdfViewer = document.getElementById(\"pdfViewer\");\n clearExistingCanvases(pdfViewer);\n\n const pagesToRender = getPagesToRender(pdf.numPages);\n await renderPdfPages(pdf, pdfViewer, pagesToRender);\n scrollToItem();\n } catch (error) {\n alertError(error);\n }\n };\n\n const scrollToItem = () => {\n if (props.args.scroll_to_page) {\n const page = document.getElementById(`canvas_page_${props.args.scroll_to_page}`);\n if (page) {\n page.scrollIntoView({ behavior: \"smooth\" });\n }\n } else if (props.args.scroll_to_annotation) {\n const annotation = document.querySelector(`[id^=\"annotation-\"][data-index=\"${props.args.scroll_to_annotation}\"]`);\n if (annotation) {\n annotation.scrollIntoView({ behavior: \"smooth\", block: \"center\" });\n }\n }\n };\n\n const setFrameHeight = () => {\n const newHeight = props.args.height || totalHeight.value;\n if (newHeight !== currentFrameHeight.value) {\n Streamlit.setFrameHeight(newHeight);\n currentFrameHeight.value = newHeight;\n }\n };\n\n const setFrameWidth = () => {\n const result = parseWidthValue(props.args.width, window.innerWidth);\n let newMaxWidth;\n if (result.type === \"percent\") {\n newMaxWidth = Math.min(Math.floor(result.value * window.innerWidth), window.innerWidth);\n } else {\n newMaxWidth = Math.min(result.value, window.innerWidth);\n }\n\n if (newMaxWidth !== maxWidth.value) {\n maxWidth.value = newMaxWidth;\n }\n };\n\n const handleResize = async () => {\n try {\n console.log('handleResize');\n if (props.args.rendering === \"unwrap\") {\n const binaryDataUrl = `data:application/pdf;base64,${props.args.binary}`;\n setFrameWidth();\n await loadPdfs(binaryDataUrl);\n setFrameHeight();\n }\n } catch (error) {\n console.error(error);\n }\n };\n\n // Debounced resize handler to prevent multiple rapid executions\n const debouncedHandleResize = debounce(handleResize, 200);\n\n onMounted(() => {\n debouncedHandleResize();\n window.addEventListener(\"resize\", debouncedHandleResize);\n });\n\n onUnmounted(() => {\n window.removeEventListener(\"resize\", debouncedHandleResize);\n });\n\n return {\n pdfContainerStyle,\n pdfViewerStyle,\n };\n },\n};\n</script>","import { render } from \"./PdfViewer.vue?vue&type=template&id=2d3a08dd\"\nimport script from \"./PdfViewer.vue?vue&type=script&lang=js\"\nexport * from \"./PdfViewer.vue?vue&type=script&lang=js\"\n\nimport exportComponent from \"../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot } from \"vue\"\n\nconst _hoisted_1 = { key: 0 }\nconst _hoisted_2 = { class: \"err__msg\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", null, [\n (_ctx.componentError != '')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _cache[0] || (_cache[0] = _createElementVNode(\"h1\", { class: \"err__title\" }, \"Component Error\", -1)),\n _createElementVNode(\"div\", _hoisted_2, \"Message: \" + _toDisplayString(_ctx.componentError), 1)\n ]))\n : (_ctx.renderData != null)\n ? _renderSlot(_ctx.$slots, \"default\", {\n key: 1,\n args: _ctx.renderData.args,\n disabled: _ctx.renderData.disabled\n }, undefined, true)\n : _createCommentVNode(\"\", true)\n ]))\n}","<template>\n <div>\n <!-- Error boundary. If our wrapped component threw an error, display it. -->\n <div v-if=\"componentError != ''\">\n <h1 class=\"err__title\">Component Error</h1>\n <div class=\"err__msg\">Message: {{ componentError }}</div>\n </div>\n <!-- \n Else render the component slot and pass Streamlit event data in `args` props to it.\n Don't render until we've gotten our first RENDER_EVENT from Streamlit.\n All components get disabled while the app is being re-run, and become re-enabled when the re-run has finished.\n -->\n <slot\n v-else-if=\"renderData != null\"\n :args=\"renderData.args\"\n :disabled=\"renderData.disabled\"\n ></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n ref,\n defineComponent,\n onMounted,\n onUpdated,\n onUnmounted,\n onErrorCaptured,\n} from \"vue\"\nimport { Streamlit, RenderData } from \"streamlit-component-lib\"\n\nexport default defineComponent({\n name: \"WithStreamlitConnection\",\n setup() {\n const renderData = ref<RenderData>((undefined as unknown) as RenderData)\n const componentError = ref(\"\")\n\n const onRenderEvent = (event: Event): void => {\n const renderEvent = event as CustomEvent<RenderData>\n renderData.value = renderEvent.detail\n componentError.value = \"\"\n }\n\n // Set up event listeners, and signal to Streamlit that we're ready.\n // We won't render the component until we receive the first RENDER_EVENT.\n onMounted(() => {\n Streamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRenderEvent)\n Streamlit.setComponentReady()\n })\n onUpdated(() => {\n // If our slot threw an error, we display it in render(). In this\n // case, the slot won't be mounted and therefore won't call\n // `setFrameHeight` on its own. We do it here so that the rendered\n // error will be visible.\n if (componentError.value != \"\") {\n Streamlit.setFrameHeight()\n }\n })\n onUnmounted(() => {\n Streamlit.events.removeEventListener(\n Streamlit.RENDER_EVENT,\n onRenderEvent\n )\n })\n onErrorCaptured(err => {\n componentError.value = String(err)\n })\n\n return {\n renderData,\n componentError,\n }\n },\n})\n</script>\n\n<style scoped>\n.err__title,\n.err__msg {\n margin: 0;\n}\n</style>\n","import { render } from \"./WithStreamlitConnection.vue?vue&type=template&id=bef81972&scoped=true&ts=true\"\nimport script from \"./WithStreamlitConnection.vue?vue&type=script&lang=ts\"\nexport * from \"./WithStreamlitConnection.vue?vue&type=script&lang=ts\"\n\nimport \"./WithStreamlitConnection.vue?vue&type=style&index=0&id=bef81972&scoped=true&lang=css\"\n\nimport exportComponent from \"../../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render],['__scopeId',\"data-v-bef81972\"]])\n\nexport default __exports__","import { render } from \"./App.vue?vue&type=template&id=6ea7f320&ts=true\"\nimport script from \"./App.vue?vue&type=script&lang=ts\"\nexport * from \"./App.vue?vue&type=script&lang=ts\"\n\nimport \"./App.vue?vue&type=style&index=0&id=6ea7f320&lang=css\"\n\nimport exportComponent from \"../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createApp } from 'vue'\nimport App from './App.vue'\n\ncreateApp(App).mount('#app')\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t524: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkstreamlit_pdf_viewer\"] = self[\"webpackChunkstreamlit_pdf_viewer\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [504], () => (__webpack_require__(711)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["_hoisted_1","id","render","_ctx","_cache","$props","$setup","$data","$options","_component_PdfViewer","_resolveComponent","_component_WithStreamlitConnection","_openBlock","_createElementBlock","_createVNode","default","_withCtx","args","_","key","style","_normalizeStyle","pdfContainerStyle","rendering","_createElementVNode","pdfViewerStyle","_hoisted_2","src","binary","width","height","type","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","CMAP_URL","CMAP_PACKED","ENABLE_XFA","acceptedBorderStyleAttributes","undefined","props","setup","totalHeight","ref","maxWidth","pageScales","pageHeights","loadedPages","currentFrameHeight","renderText","pages_to_render","length","render_text","parseWidthValue","widthValue","fallbackValue","window","innerWidth","endsWith","num","parseFloat","isNaN","value","numeric","Number","computed","result","widthCSS","overflow","position","clearExistingCanvases","pdfViewer","innerHTML","createCanvasForPage","page","scale","rotation","pageNumber","resolutionRatioBoost","viewport","getViewport","ratio","devicePixelRatio","canvas","document","createElement","pages_vertical_spacing","display","marginBottom","getContext","renderAnnotation","annotation","annotationIndex","pageDiv","annotationDiv","setAttribute","left","x","top","y","border","includes","outline","annotation_outline_size","color","cursor","pointerEvents","zIndex","addEventListener","Streamlit","setComponentValue","clicked_annotation","index","appendChild","renderPage","async","annotations","annotationCount","renderContext","canvasContext","promise","className","canvasWrapper","textContent","getTextContent","textLayerDiv","textLayer","pdfjsLib","textContentSource","container","textDivs","forEach","annotationUniqueIndex","getElementById","getPagesToRender","numPages","Array","from","i","renderPdfPages","pdf","pagesToRender","resolutionBoost","resolution_boost","getPage","rotate","unscaledViewport","widthScale","possibleScaledWidth","push","setProperty","intent","annotationsForPage","filter","anno","alertError","error","console","alert","message","loadPdfs","workerSrc","loadingTask","getDocument","url","cMapUrl","cMapPacked","enableXfa","scrollToItem","scroll_to_page","scrollIntoView","behavior","scroll_to_annotation","querySelector","block","setFrameHeight","newHeight","setFrameWidth","newMaxWidth","Math","min","floor","handleResize","log","binaryDataUrl","debouncedHandleResize","debounce","onMounted","onUnmounted","removeEventListener","__exports__","class","componentError","_toDisplayString","renderData","_renderSlot","$slots","disabled","_createCommentVNode","defineComponent","name","onRenderEvent","event","renderEvent","detail","events","RENDER_EVENT","setComponentReady","onUpdated","onErrorCaptured","err","String","components","PdfViewer","WithStreamlitConnection","createApp","App","mount","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","loaded","__webpack_modules__","call","m","deferred","O","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","Object","keys","every","splice","r","d","definition","o","defineProperty","enumerable","get","g","globalThis","this","Function","e","obj","prop","prototype","hasOwnProperty","nmd","paths","children","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","data","moreModules","runtime","some","chunkLoadingGlobal","self","bind","__webpack_exports__"],"sourceRoot":""}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamlit-pdf-viewer
3
- Version: 0.0.23.dev0
3
+ Version: 0.0.23.dev1
4
4
  Summary: Streamlit component for PDF visualisation and manipulation
5
5
  Home-page: https://github.com/lfoppiano/streamlit-pdf-viewer
6
6
  Author: Luca Foppiano, Tomoya Mato
@@ -29,11 +29,13 @@ Dynamic: summary
29
29
  # streamlit-pdf-viewer
30
30
 
31
31
  Streamlit component that allows the visualisation and enrichment of PDF documents.
32
- You can see an [application](https://github.com/lfoppiano/structure-vision) in action [here](https://structure-vision.streamlit.app/).
32
+ You can see an [application](https://github.com/lfoppiano/structure-vision) in
33
+ action [here](https://structure-vision.streamlit.app/).
33
34
 
34
35
  <img src="https://github.com/lfoppiano/streamlit-pdf-viewer/raw/main/docs/screenshot.png" width=500 align="right" />
35
36
 
36
37
  ## Features
38
+
37
39
  - Show PDF files in a Streamlit application with a simple command
38
40
  - Based on the pdf.js library
39
41
  - Visualize annotations on top of the PDF documents
@@ -41,26 +43,32 @@ You can see an [application](https://github.com/lfoppiano/structure-vision) in a
41
43
  - Allow to render specific pages of the PDF document
42
44
  - Scroll to a specific page
43
45
  - Scroll to a specific annotation
44
- - Allow custom callbacks when an annotation is clicked
45
- - Additional support showing PDF documents using the native pdf.js browser's viewer: "legacy" (with limitations, no annotations, no scrolling, etc..)
46
+ - Allow custom callbacks when an annotation is clicked
47
+ - Additional support showing PDF documents using the native pdf.js browser's viewer: "legacy" (with limitations, no
48
+ annotations, no scrolling, etc..)
46
49
 
47
50
  ## Limitations
51
+
48
52
  - Tested and developed to support Firefox and Chrome.
49
- - The legacy visualization works only on Firefox and does not support annotations
50
- - Our Javascript skills are limited, so all troubleshooting may take time
53
+ - The legacy visualization works only on Firefox and does not support annotations
54
+ - Our Javascript skills are limited, so all troubleshooting may take time
51
55
  - The component is still in development, so expect some bugs and limitations
52
56
  - The streamlit reload at each action may render slowly for complex PDF documents
53
57
 
54
58
  ## Caveats
55
- Here some caveats to be aware of:
56
- - It 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.
57
- - From version 0.0.16, the behavior for managing width and height has changed:
58
- - If only the height is specified, the PDF document will be shown in proportion with the with proportional based on the PDF dimensions.
59
- - The possibility to show a large view of half the PDF is not available anymore (let's face it, it was not very useful).
60
- - If you need to use all the available space and limit the height, you can encapsulate the `pdf_viewer()` into a `st.component(width:...)` setting the width.
61
- - The `legacy` rendering is not supported on Chrome, due to security reasons.
62
-
63
59
 
60
+ Here some caveats to be aware of:
61
+
62
+ - It is mandatory to specify a `width` to show PDF document on tabs and expanders, otherwise, the viewer will not be
63
+ displayed on tabs not immediately visible.
64
+ - From version 0.0.16, the behavior for managing width and height has changed:
65
+ - If only the height is specified, the PDF document will be shown in proportion with the with proportional based on
66
+ the PDF dimensions.
67
+ - The possibility to show a large view of half the PDF is not available anymore (let's face it, it was not very
68
+ useful).
69
+ - If you need to use all the available space and limit the height, you can encapsulate the `pdf_viewer()` into a
70
+ `st.component(width:...)` setting the width.
71
+ - The `legacy` rendering is not supported on Chrome, due to security reasons.
64
72
 
65
73
  ## Getting started
66
74
 
@@ -81,42 +89,49 @@ pdf_viewer("str, path or bytes")
81
89
 
82
90
  In the following table the list of parameters that can be provided to the `pdf_viewer` function:
83
91
 
84
- | name | description |
85
- |---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
86
- | input | The source of the PDF file. Accepts a file path or binary data. |
87
- | width | Width of the PDF viewer in pixels. It defaults to 700 pixels. It supports both integer (pixel, e.g. `700`) and string (percentages, e.g. `90%` will make the pdf render to 90% of the container/window/screen width. If the pdf width is larger than the screen width, it will horizontally scroll). |
88
- | height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
89
- | annotations | A list of annotations to be overlaid on the PDF. Format is described [here](#annotation-format). |
90
- | pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
91
- | annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
92
- | rendering | Type of rendering: `unwrap` (default), `legacy_iframe`, or `legacy_embed`. The default value, `unwrap` shows the PDF document using pdf.js, and supports the visualisation of annotations. Other values are `legacy_iframe` and `legacy_embed` which use the legacy approach of injecting the document into an `<embed>` or `<iframe>`. They allow viewing the PDF using the viewer of the browser that contains additional features we are still working to implement in this component. **IMPORTANT**: :warning: The "legacy" methods **work only with Firefox**, and **do not support annotations**. :warning: |
93
- | pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
94
- | render_text | Enable a layer of text on top of the PDF document. The text may be selected and copied. **NOTE** to avoid breaking existing deployments, we made this optional at first, also considering that having many annotations might interfere with the copy-paste. |
95
- | scroll_to_page | Scroll to a specific page when the component is rendered. Default is None. Require ints and ignores the parameters below zero. |
96
- | scroll_to_annotation | Scroll to a specific annotation when the component is rendered. Default is None. Mutually exclusive with `scroll_to_page`. Raise an exception if used with `scroll_to_page` |
97
- | on_annotation_click | Callback function that is called when an annotation is clicked. The function receives the annotation as a parameter. |
98
-
99
- ### Annotation format
100
- The annotations format has been derived from the [Grobid's coordinate formats](https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/), which are described as a list of "bounding boxes".
101
- The annotations are expressed as a dictionary of six elements, the page, x and y indicate the top left point. The color can be expressed following the html CSS convention.
102
-
103
- Here an example:
92
+ | name | description |
93
+ |-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
94
+ | input | The source of the PDF file. Accepts a file path or binary data. |
95
+ | width | Width of the PDF viewer in pixels. It defaults to 700 pixels. It supports both integer (pixel, e.g. `700`) and string (percentages, e.g. `90%` will make the pdf render to 90% of the container/window/screen width. If the pdf width is larger than the screen width, it will horizontally scroll). |
96
+ | height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
97
+ | annotations | A list of annotations to be overlaid on the PDF. Format is described [here](#annotation-format). |
98
+ | pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
99
+ | annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
100
+ | rendering | Type of rendering: `unwrap` (default), `legacy_iframe`, or `legacy_embed`. The default value, `unwrap` shows the PDF document using pdf.js, and supports the visualisation of annotations. Other values are `legacy_iframe` and `legacy_embed` which use the legacy approach of injecting the document into an `<embed>` or `<iframe>`. They allow viewing the PDF using the viewer of the browser that contains additional features we are still working to implement in this component. **IMPORTANT**: :warning: The "legacy" methods **work only with Firefox**, and **do not support annotations**. :warning: |
101
+ | pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
102
+ | render_text | Enable a layer of text on top of the PDF document. The text may be selected and copied. **NOTE** to avoid breaking existing deployments, we made this optional at first, also considering that having many annotations might interfere with the copy-paste. |
103
+ | scroll_to_page | Scroll to a specific page when the component is rendered. The parameter is an integer, which represent the positional value of the page. E.g. 1, will be the first page. Default is None. Require ints and ignores the parameters below zero. |
104
+ | scroll_to_annotation | Scroll to a specific annotation when the component is rendered. The parameter is an integer, which represent the positional value of the annotation. E.g. 1, will be the first annotation. Default is None (don't scroll). Mutually exclusive with `scroll_to_page`. Raise an exception if used with `scroll_to_page` |
105
+ | on_annotation_click | Callback function that is called when an annotation is clicked. The function receives the annotation as a parameter. |
106
+
107
+ ### Annotation format
108
+
109
+ The annotations format has been derived from
110
+ the [Grobid's coordinate formats](https://grobid.readthedocs.io/en/latest/Coordinates-in-PDF/), which are described as a
111
+ list of "bounding boxes".
112
+ The annotations are expressed as a dictionary of six elements, the page, x and y indicate the top left point. The color
113
+ can be expressed following the html CSS convention.
114
+
115
+ Here an example:
104
116
 
105
117
  ```json
106
118
  [
107
- {
108
- "page": 1,
109
- "x": 220,
110
- "y": 155,
111
- "height": 22,
112
- "width": 65,
113
- "color": "red",
114
- "border": "solid"
115
- },
116
- [...]
119
+ {
120
+ "page": 1,
121
+ "x": 220,
122
+ "y": 155,
123
+ "height": 22,
124
+ "width": 65,
125
+ "color": "red",
126
+ "border": "solid"
127
+ },
128
+ [
129
+ ...
130
+ ]
117
131
  ```
118
132
 
119
- The `border` parameter can be set with the following values: `solid`, `dashed`, `dotted`, `double`, `groove`, `ridge`, `inset`, `outset`. Any other value will result in the default value: `solid`.
133
+ The `border` parameter can be set with the following values: `solid`, `dashed`, `dotted`, `double`, `groove`, `ridge`,
134
+ `inset`, `outset`. Any other value will result in the default value: `solid`.
120
135
 
121
136
  The example shown in our screenshot can be found [here](resources/annotations.json).
122
137
 
@@ -145,18 +160,19 @@ annotations = [
145
160
  }
146
161
  ]
147
162
 
163
+
148
164
  def my_custom_annotation_handler(annotation):
149
165
  print(f"Annotation {annotation} clicked.")
150
166
 
167
+
151
168
  pdf_viewer(
152
- "path/to/pdf",
153
- on_annotation_click=my_custom_annotation_handler,
154
- annotations=annotations
169
+ "path/to/pdf",
170
+ on_annotation_click=my_custom_annotation_handler,
171
+ annotations=annotations
155
172
  )
156
173
 
157
174
  ```
158
175
 
159
-
160
176
  ## Developers notes
161
177
 
162
178
  ### Environment
@@ -167,7 +183,8 @@ pdf_viewer(
167
183
 
168
184
  ### Configure environment for development
169
185
 
170
- First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode, use the following commands:
186
+ First, make sure that _RELEASE = False in `streamlit_pdf_viewer/__init__.py`. To run the component in development mode,
187
+ use the following commands:
171
188
 
172
189
  ```shell
173
190
  streamlit run streamlit_pdf_viewer/__init__.py
@@ -176,7 +193,8 @@ cd frontend
176
193
  npm run serve
177
194
  ```
178
195
 
179
- These commands will start the Streamlit application and serve the Node.js component. Please make sure you're in the correct directory before running these commands.
196
+ These commands will start the Streamlit application and serve the Node.js component. Please make sure you're in the
197
+ correct directory before running these commands.
180
198
 
181
199
  ### Integrate into a streamlit application
182
200
 
@@ -21,8 +21,8 @@ streamlit_pdf_viewer/frontend/dist/img/cursor-editorTextHighlight.5636640c.svg
21
21
  streamlit_pdf_viewer/frontend/dist/img/editor-toolbar-delete.6694a89f.svg
22
22
  streamlit_pdf_viewer/frontend/dist/img/toolbarButton-editorHighlight.c3287eaa.svg
23
23
  streamlit_pdf_viewer/frontend/dist/img/toolbarButton-menuArrow.37a6145d.svg
24
- streamlit_pdf_viewer/frontend/dist/js/app.3d9d09f3.js
25
- streamlit_pdf_viewer/frontend/dist/js/app.3d9d09f3.js.map
24
+ streamlit_pdf_viewer/frontend/dist/js/app.91327107.js
25
+ streamlit_pdf_viewer/frontend/dist/js/app.91327107.js.map
26
26
  streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a7b421ed.js
27
27
  streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a7b421ed.js.map
28
28
  tests/__init__.py
@@ -1,2 +0,0 @@
1
- (()=>{"use strict";var e={9957:(e,t,n)=>{var r=n(3751),a=n(641);const i={id:"app"};function o(e,t,n,r,o,s){const l=(0,a.g2)("PdfViewer"),d=(0,a.g2)("WithStreamlitConnection");return(0,a.uX)(),(0,a.CE)("div",i,[(0,a.bF)(d,null,{default:(0,a.k6)((({args:e})=>[(0,a.bF)(l,{args:e},null,8,["args"])])),_:1})])}var s=n(33);const l={key:0},d={key:1},c=["src","width","height"],p={key:2},h=["src","width","height"],g={key:3};function u(e,t,n,r,i,o){return(0,a.uX)(),(0,a.CE)("div",{id:"pdfContainer",style:(0,s.Tr)(r.pdfContainerStyle)},["unwrap"===n.args.rendering?((0,a.uX)(),(0,a.CE)("div",l,[(0,a.Lk)("div",{id:"pdfViewer",style:(0,s.Tr)(r.pdfViewerStyle)},null,4)])):"legacy_embed"===n.args.rendering?((0,a.uX)(),(0,a.CE)("div",d,[(0,a.Lk)("embed",{src:`data:application/pdf;base64,${n.args.binary}`,width:`${n.args.width}`,height:`${n.args.height}`,type:"application/pdf"},null,8,c)])):"legacy_iframe"===n.args.rendering?((0,a.uX)(),(0,a.CE)("div",p,[(0,a.Lk)("embed",{src:`data:application/pdf;base64,${n.args.binary}`,width:`${n.args.width}`,height:`${n.args.height}`,type:"application/pdf"},null,8,h)])):((0,a.uX)(),(0,a.CE)("div",g," Error rendering option. "))],4)}n(4114),n(8111),n(2489),n(7588);var v=n(953),w=(n(951),n(9936)),y=n(7445),f=n(2543);const m="pdfjs-dist/cmaps/",_=!0,b=!0,E=["solid","dashed","dotted","double","groove","ridge","inset","outset","none",void 0,null],x={props:["args"],setup(e){const t=(0,v.KR)(0),n=(0,v.KR)(0),r=(0,v.KR)([]),i=(0,v.KR)([]),o=(0,v.KR)([]),s=(0,v.KR)(e.args.height||0),l=(e.args.pages_to_render.length,!0===e.args.render_text),d=(e,t=window.innerWidth)=>{if("string"===typeof e&&e.endsWith("%")){const t=parseFloat(e);if(!isNaN(t))return{type:"percent",value:t/100}}const n=Number(e);return!isNaN(n)&&n>0?{type:"pixel",value:n}:{type:"pixel",value:t}},c=(0,a.EW)((()=>{const t=d(e.args.width,window.innerWidth),n="percent"===t.type?100*t.value+"%":`${t.value}px`;return{width:n,height:e.args.height?`${e.args.height}px`:"auto",overflow:"auto",position:"relative"}})),p={position:"relative"},h=e=>{e&&(e.innerHTML="")},g=(t,n,r,a,i=1)=>{const o=t.getViewport({scale:n,rotation:r}),s=(window.devicePixelRatio||1)*i,l=document.createElement("canvas");return l.id=`canvas_page_${a}`,l.height=o.height*s+e.args.pages_vertical_spacing,l.width=o.width*s,l.style.width=`${o.width}px`,l.style.height=`${o.height}px`,l.style.display="block",l.style.marginBottom=`${e.args.pages_vertical_spacing}px`,l.getContext("2d").scale(s,s),l},u=(t,n,r)=>{const a=document.createElement("div");a.id=`annotation-${t.id||t.page}-${t.index}`,a.style.position="absolute",a.style.left=t.x*r+"px",a.style.top=t.y*r+"px",a.style.width=t.width*r+"px",a.style.height=t.height*r+"px";let i=t.border;t.border&&E.includes(t.border)||(i="solid"),a.style.outline=`${e.args.annotation_outline_size*r}px ${i} ${t.color}`,a.style.cursor=l?"text":"pointer",a.style.pointerEvents=l?"none":"auto",a.style.zIndex=10,l||a.addEventListener("click",(()=>{y.wk.setComponentValue({clicked_annotation:{index:t.index,...t}})})),n.appendChild(a)},x=async(e,t,n,r)=>{const a={canvasContext:t.getContext("2d"),viewport:n};await e.render(a).promise;const i=document.createElement("div");i.className="page",i.style.position="relative",i.style.width=`${n.width}px`,i.style.height=`${n.height}px`;const o=document.createElement("div");if(o.className="canvasWrapper",o.style.position="absolute",o.style.top="0",o.style.left="0",o.appendChild(t),i.appendChild(o),l){const t=await e.getTextContent(),r=document.createElement("div");r.className="textLayer",r.style.zIndex="11",r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.height=`${n.height}px`,r.style.width=`${n.width}px`;const a=new w.D6({textContentSource:t,container:r,viewport:n,textDivs:[]});await a.render(),i.appendChild(r)}r&&r.length>0&&r.forEach((e=>{u(e,i,n.scale)}));const s=document.getElementById("pdfViewer");s.appendChild(i)},k=t=>0===e.args.pages_to_render.length?Array.from({length:t},((e,t)=>t+1)):e.args.pages_to_render,C=async(a,s,l)=>{t.value=0,r.value=[],i.value=[],o.value=[];const d=e.args.resolution_boost||1;for(let c=1;c<=a.numPages;c++){const p=await a.getPage(c),h=p.rotate,u=p.getViewport({scale:1,rotation:h});if(e.args.height>0){const t=u.width/u.height,r=t*e.args.height;(0===n.value||r<n.value)&&(n.value=r)}const v=n.value/u.width;if(r.value.push(v),i.value.push(u.height),l.includes(c)){const n=g(p,v,h,c,d);s.style.setProperty("--scale-factor",v);const r=p.getViewport({scale:v,rotation:h,intent:"print"}),a=e.args.annotations.filter((e=>Number(e.page)===c));t.value+=n.height/((window.devicePixelRatio||1)*d),await x(p,n,r,a),n.id&&o.value.push(n.id)}}l.length>0&&(t.value-=e.args.pages_vertical_spacing)},$=e=>{window.alert(e.message),console.error(e)},R=async e=>{w.EA.workerSrc="pdfjs-dist/build/pdf.worker.mjs";try{const t=(0,w.YE)({url:e,cMapUrl:m,cMapPacked:_,enableXfa:b}),n=await t.promise,r=document.getElementById("pdfViewer");h(r);const a=k(n.numPages);await C(n,r,a),V()}catch(t){$(t)}},V=()=>{if(e.args.scroll_to_page){const t=document.getElementById(`canvas_page_${e.args.scroll_to_page}`);t&&t.scrollIntoView({behavior:"smooth"})}else if(e.args.scroll_to_annotation){const t=document.querySelector(`[id^="annotation-"][data-index="${e.args.scroll_to_annotation}"]`);t&&t.scrollIntoView({behavior:"smooth",block:"center"})}},N=()=>{const n=e.args.height||t.value;n!==s.value&&(y.wk.setFrameHeight(n),s.value=n)},L=()=>{const t=d(e.args.width,window.innerWidth);let r;r="percent"===t.type?Math.min(Math.floor(t.value*window.innerWidth),window.innerWidth):Math.min(t.value,window.innerWidth),r!==n.value&&(n.value=r)},W=async()=>{try{if(console.log("handleResize"),"unwrap"===e.args.rendering){const t=`data:application/pdf;base64,${e.args.binary}`;L(),await R(t),N()}}catch(t){console.error(t)}},O=(0,f.debounce)(W,200);return(0,a.sV)((()=>{O(),window.addEventListener("resize",O)})),(0,a.hi)((()=>{window.removeEventListener("resize",O)})),{pdfContainerStyle:c,pdfViewerStyle:p}}};var k=n(6262);const C=(0,k.A)(x,[["render",u]]),$=C,R={key:0},V={class:"err__msg"};function N(e,t,n,r,i,o){return(0,a.uX)(),(0,a.CE)("div",null,[""!=e.componentError?((0,a.uX)(),(0,a.CE)("div",R,[t[0]||(t[0]=(0,a.Lk)("h1",{class:"err__title"},"Component Error",-1)),(0,a.Lk)("div",V,"Message: "+(0,s.v_)(e.componentError),1)])):null!=e.renderData?(0,a.RG)(e.$slots,"default",{key:1,args:e.renderData.args,disabled:e.renderData.disabled},void 0,!0):(0,a.Q3)("",!0)])}const L=(0,a.pM)({name:"WithStreamlitConnection",setup(){const e=(0,v.KR)(void 0),t=(0,v.KR)(""),n=n=>{const r=n;e.value=r.detail,t.value=""};return(0,a.sV)((()=>{y.wk.events.addEventListener(y.wk.RENDER_EVENT,n),y.wk.setComponentReady()})),(0,a.$u)((()=>{""!=t.value&&y.wk.setFrameHeight()})),(0,a.hi)((()=>{y.wk.events.removeEventListener(y.wk.RENDER_EVENT,n)})),(0,a.qG)((e=>{t.value=String(e)})),{renderData:e,componentError:t}}}),W=(0,k.A)(L,[["render",N],["__scopeId","data-v-bef81972"]]),O=W,P=(0,a.pM)({name:"App",components:{PdfViewer:$,WithStreamlitConnection:O}}),S=(0,k.A)(P,[["render",o]]),j=S;(0,r.Ef)(j).mount("#app")}},t={};function n(r){var a=t[r];if(void 0!==a)return a.exports;var i=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.loaded=!0,i.exports}n.m=e,(()=>{var e=[];n.O=(t,r,a,i)=>{if(!r){var o=1/0;for(c=0;c<e.length;c++){for(var[r,a,i]=e[c],s=!0,l=0;l<r.length;l++)(!1&i||o>=i)&&Object.keys(n.O).every((e=>n.O[e](r[l])))?r.splice(l--,1):(s=!1,i<o&&(o=i));if(s){e.splice(c--,1);var d=a();void 0!==d&&(t=d)}}return t}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[r,a,i]}})(),(()=>{n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()})(),(()=>{n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e)})(),(()=>{var e={524:0};n.O.j=t=>0===e[t];var t=(t,r)=>{var a,i,[o,s,l]=r,d=0;if(o.some((t=>0!==e[t]))){for(a in s)n.o(s,a)&&(n.m[a]=s[a]);if(l)var c=l(n)}for(t&&t(r);d<o.length;d++)i=o[d],n.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return n.O(c)},r=self["webpackChunkstreamlit_pdf_viewer"]=self["webpackChunkstreamlit_pdf_viewer"]||[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();var r=n.O(void 0,[504],(()=>n(9957)));r=n.O(r)})();
2
- //# sourceMappingURL=app.3d9d09f3.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"js/app.3d9d09f3.js","mappings":"gEAEA,MAAMA,EAAa,CCIZC,GAAG,ODFJ,SAAUC,E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U,OAAE1L,EAAW,CAAC,MAAM,IAAOgL,EAAoB,QAC7FoD,EAAsBpD,EAAoBU,EAAE0C,E","sources":["webpack://streamlit_pdf_viewer/./src/App.vue?9ab1","webpack://streamlit_pdf_viewer/./src/App.vue","webpack://streamlit_pdf_viewer/./src/PdfViewer.vue","webpack://streamlit_pdf_viewer/./src/PdfViewer.vue?f557","webpack://streamlit_pdf_viewer/./src/streamlit/WithStreamlitConnection.vue?8d46","webpack://streamlit_pdf_viewer/./src/streamlit/WithStreamlitConnection.vue","webpack://streamlit_pdf_viewer/./src/streamlit/WithStreamlitConnection.vue?1dfc","webpack://streamlit_pdf_viewer/./src/App.vue?7ccd","webpack://streamlit_pdf_viewer/./src/main.ts","webpack://streamlit_pdf_viewer/webpack/bootstrap","webpack://streamlit_pdf_viewer/webpack/runtime/chunk loaded","webpack://streamlit_pdf_viewer/webpack/runtime/define property getters","webpack://streamlit_pdf_viewer/webpack/runtime/global","webpack://streamlit_pdf_viewer/webpack/runtime/hasOwnProperty shorthand","webpack://streamlit_pdf_viewer/webpack/runtime/node module decorator","webpack://streamlit_pdf_viewer/webpack/runtime/jsonp chunk loading","webpack://streamlit_pdf_viewer/webpack/startup"],"sourcesContent":["import { resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock } from \"vue\"\n\nconst _hoisted_1 = { id: \"app\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n const _component_PdfViewer = _resolveComponent(\"PdfViewer\")!\n const _component_WithStreamlitConnection = _resolveComponent(\"WithStreamlitConnection\")!\n\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(_component_WithStreamlitConnection, null, {\n default: _withCtx(({ args }) => [\n _createVNode(_component_PdfViewer, { args: args }, null, 8, [\"args\"])\n ]),\n _: 1\n })\n ]))\n}","<!-- \n We bootstrap our Component to Streamlit with our scoped slot in the top-level App.\n This is where scoped slot passes Streamlit `args` data from itself to children MyComponent.\n You should not have to edit this, but are free to do so :)\n-->\n<template>\n <div id=\"app\">\n <WithStreamlitConnection v-slot=\"{ args }\">\n <PdfViewer :args=\"args\" />\n </WithStreamlitConnection>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from \"vue\"\nimport PdfViewer from \"./PdfViewer.vue\"\n\n// \"withStreamlitConnection\" is a scoped slot. It bootstraps the\n// connection between your component and the Streamlit app, and handles\n// passing arguments from Python -> Component.\n//\n// You don't need to edit withStreamlitConnection (but you're welcome to!).\nimport WithStreamlitConnection from \"./streamlit/WithStreamlitConnection.vue\"\n\nexport default defineComponent({\n name: \"App\",\n components: {\n PdfViewer,\n WithStreamlitConnection,\n },\n})\n</script>\n\n<style>\nbody {\n margin: 0;\n}\n#app {\n font-family: Avenir, Helvetica, Arial, sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n color: #2c3e50;\n}\n</style>\n","<template>\n <div id=\"pdfContainer\" :style=\"pdfContainerStyle\">\n <div v-if=\"args.rendering === 'unwrap'\">\n <div id=\"pdfViewer\" :style=\"pdfViewerStyle\"></div>\n </div>\n <div v-else-if=\"args.rendering === 'legacy_embed'\">\n <embed :src=\"`data:application/pdf;base64,${args.binary}`\" :width=\"`${args.width}`\" :height=\"`${args.height}`\"\n type=\"application/pdf\"/>\n </div>\n <div v-else-if=\"args.rendering === 'legacy_iframe'\">\n <embed :src=\"`data:application/pdf;base64,${args.binary}`\" :width=\"`${args.width}`\" :height=\"`${args.height}`\"\n type=\"application/pdf\"/>\n </div>\n <div v-else>\n Error rendering option.\n </div>\n </div>\n</template>\n\n<script>\nimport { onMounted, onUpdated, computed, ref, onUnmounted } from \"vue\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport \"pdfjs-dist/build/pdf.worker.mjs\";\nimport { getDocument } from \"pdfjs-dist/build/pdf\";\nimport { Streamlit } from \"streamlit-component-lib\";\nimport * as pdfjsLib from \"pdfjs-dist\";\nimport { debounce } from 'lodash';\n\nconst CMAP_URL = \"pdfjs-dist/cmaps/\";\nconst CMAP_PACKED = true;\nconst ENABLE_XFA = true;\nconst acceptedBorderStyleAttributes = ['solid', 'dashed', 'dotted', 'double', 'groove', 'ridge', 'inset', 'outset', 'none', undefined, null];\n\nexport default {\n props: [\"args\"],\n\n setup(props) {\n const totalHeight = ref(0);\n const maxWidth = ref(0);\n const pageScales = ref([]);\n const pageHeights = ref([]);\n const loadedPages = ref([]);\n const currentFrameHeight = ref(props.args.height || 0);\n\n const isRenderingAllPages = props.args.pages_to_render.length === 0;\n\n const renderText = props.args.render_text === true;\n\n const parseWidthValue = (widthValue, fallbackValue = window.innerWidth) => {\n if (typeof widthValue === \"string\" && widthValue.endsWith(\"%\")) {\n const num = parseFloat(widthValue)\n if (!isNaN(num)) {\n return { type: \"percent\", value: num / 100 }\n }\n }\n const numeric = Number(widthValue)\n if (!isNaN(numeric) && numeric > 0) {\n return { type: \"pixel\", value: numeric }\n }\n return { type: \"pixel\", value: fallbackValue }\n }\n\n const pdfContainerStyle = computed(() => {\n const result = parseWidthValue(props.args.width, window.innerWidth);\n const widthCSS = result.type === \"percent\" ? `${result.value * 100}%` : `${result.value}px`;\n return {\n width: widthCSS,\n height: props.args.height ? `${props.args.height}px` : 'auto',\n overflow: 'auto',\n position: 'relative',\n };\n });\n\n const pdfViewerStyle = { position: 'relative' };\n\n const calculatePdfsHeight = (page) => {\n let height = 0;\n if (isRenderingAllPages) {\n for (let i = 0; i < page - 1; i++) {\n height += pageHeights.value[i] * pageScales.value[i] + props.args.pages_vertical_spacing;\n }\n } else {\n for (let i = 0; i < pageHeights.value.length; i++) {\n if (props.args.pages_to_render.includes(i + 1) && i < page - 1) {\n height += pageHeights.value[i] * pageScales.value[i] + props.args.pages_vertical_spacing;\n }\n }\n }\n return height;\n };\n\n const clearExistingCanvases = (pdfViewer) => {\n if (!pdfViewer) return;\n pdfViewer.innerHTML = '';\n };\n\n const createCanvasForPage = (page, scale, rotation, pageNumber, resolutionRatioBoost = 1) => {\n const viewport = page.getViewport({ scale, rotation });\n const ratio = (window.devicePixelRatio || 1) * resolutionRatioBoost;\n\n const canvas = document.createElement(\"canvas\");\n canvas.id = `canvas_page_${pageNumber}`;\n canvas.height = viewport.height * ratio + props.args.pages_vertical_spacing;\n canvas.width = viewport.width * ratio;\n canvas.style.width = `${viewport.width}px`;\n canvas.style.height = `${viewport.height}px`;\n canvas.style.display = \"block\";\n canvas.style.marginBottom = `${props.args.pages_vertical_spacing}px`;\n canvas.getContext(\"2d\").scale(ratio, ratio);\n\n return canvas;\n };\n\n const renderAnnotation = (annotation, pageDiv, scale) => {\n const annotationDiv = document.createElement('div');\n annotationDiv.id = `annotation-${annotation.id || annotation.page}-${annotation.index}`;\n annotationDiv.style.position = 'absolute';\n annotationDiv.style.left = `${annotation.x * scale}px`;\n annotationDiv.style.top = `${annotation.y * scale}px`;\n annotationDiv.style.width = `${annotation.width * scale}px`;\n annotationDiv.style.height = `${annotation.height * scale}px`;\n let border = annotation.border\n if (!annotation.border || !acceptedBorderStyleAttributes.includes(annotation.border)) {\n border = \"solid\"\n }\n annotationDiv.style.outline = `${props.args.annotation_outline_size * scale}px ${border} ${annotation.color}`;\n annotationDiv.style.cursor = renderText ? 'text' : 'pointer';\n annotationDiv.style.pointerEvents = renderText ? 'none' : 'auto';\n annotationDiv.style.zIndex = 10;\n\n if (!renderText) {\n annotationDiv.addEventListener('click', () => {\n Streamlit.setComponentValue({\n clicked_annotation: { index: annotation.index, ...annotation },\n });\n });\n }\n\n pageDiv.appendChild(annotationDiv);\n };\n\n const renderPage = async (page, canvas, viewport, annotations) => {\n const renderContext = {\n canvasContext: canvas.getContext(\"2d\"),\n viewport: viewport\n };\n\n await page.render(renderContext).promise;\n\n const pageDiv = document.createElement('div');\n pageDiv.className = 'page';\n pageDiv.style.position = 'relative';\n pageDiv.style.width = `${viewport.width}px`;\n pageDiv.style.height = `${viewport.height}px`;\n\n const canvasWrapper = document.createElement('div');\n canvasWrapper.className = 'canvasWrapper';\n canvasWrapper.style.position = 'absolute';\n canvasWrapper.style.top = '0';\n canvasWrapper.style.left = '0';\n canvasWrapper.appendChild(canvas);\n\n pageDiv.appendChild(canvasWrapper);\n\n if (renderText) {\n const textContent = await page.getTextContent();\n const textLayerDiv = document.createElement(\"div\");\n textLayerDiv.className = \"textLayer\";\n textLayerDiv.style.zIndex = \"11\";\n textLayerDiv.style.position = 'absolute';\n textLayerDiv.style.top = '0';\n textLayerDiv.style.left = '0';\n textLayerDiv.style.height = `${viewport.height}px`;\n textLayerDiv.style.width = `${viewport.width}px`;\n\n const textLayer = new pdfjsLib.TextLayer({\n textContentSource: textContent,\n container: textLayerDiv,\n viewport: viewport,\n textDivs: []\n });\n await textLayer.render();\n\n pageDiv.appendChild(textLayerDiv);\n }\n\n if (annotations && annotations.length > 0) {\n annotations.forEach(annotation => {\n renderAnnotation(annotation, pageDiv, viewport.scale);\n });\n }\n\n const pdfViewer = document.getElementById(\"pdfViewer\");\n pdfViewer.appendChild(pageDiv);\n };\n\n const getPagesToRender = (numPages) => {\n if (props.args.pages_to_render.length === 0) {\n return Array.from({ length: numPages }, (_, i) => i + 1);\n }\n return props.args.pages_to_render;\n };\n\n const renderPdfPages = async (pdf, pdfViewer, pagesToRender) => {\n totalHeight.value = 0;\n pageScales.value = [];\n pageHeights.value = [];\n loadedPages.value = [];\n\n const resolutionBoost = props.args.resolution_boost || 1;\n\n for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {\n const page = await pdf.getPage(pageNumber);\n const rotation = page.rotate;\n const unscaledViewport = page.getViewport({ scale: 1.0, rotation });\n\n if (props.args.height > 0) {\n const widthScale = unscaledViewport.width / unscaledViewport.height;\n const possibleScaledWidth = widthScale * props.args.height;\n if (maxWidth.value === 0 || possibleScaledWidth < maxWidth.value) {\n maxWidth.value = possibleScaledWidth;\n }\n }\n\n const scale = maxWidth.value / unscaledViewport.width;\n\n pageScales.value.push(scale);\n pageHeights.value.push(unscaledViewport.height);\n\n if (pagesToRender.includes(pageNumber)) {\n const canvas = createCanvasForPage(page, scale, rotation, pageNumber, resolutionBoost);\n pdfViewer.style.setProperty('--scale-factor', scale);\n\n const viewport = page.getViewport({\n scale: scale,\n rotation: rotation,\n intent: \"print\",\n });\n\n const annotationsForPage = props.args.annotations.filter(\n anno => Number(anno.page) === pageNumber\n );\n\n totalHeight.value += canvas.height / ((window.devicePixelRatio || 1) * resolutionBoost);\n await renderPage(page, canvas, viewport, annotationsForPage);\n\n if (canvas.id) {\n loadedPages.value.push(canvas.id);\n }\n }\n }\n // Subtract the margin for the last page as it's not needed\n if (pagesToRender.length > 0) {\n totalHeight.value -= props.args.pages_vertical_spacing;\n }\n };\n\n const alertError = (error) => {\n window.alert(error.message);\n console.error(error);\n };\n\n const loadPdfs = async (url) => {\n pdfjsLib.GlobalWorkerOptions.workerSrc = 'pdfjs-dist/build/pdf.worker.mjs';\n try {\n const loadingTask = getDocument({\n url: url,\n cMapUrl: CMAP_URL,\n cMapPacked: CMAP_PACKED,\n enableXfa: ENABLE_XFA,\n });\n const pdf = await loadingTask.promise;\n\n const pdfViewer = document.getElementById(\"pdfViewer\");\n clearExistingCanvases(pdfViewer);\n\n const pagesToRender = getPagesToRender(pdf.numPages);\n await renderPdfPages(pdf, pdfViewer, pagesToRender);\n scrollToItem();\n } catch (error) {\n alertError(error);\n }\n };\n\n const scrollToItem = () => {\n if (props.args.scroll_to_page) {\n const page = document.getElementById(`canvas_page_${props.args.scroll_to_page}`);\n if (page) {\n page.scrollIntoView({ behavior: \"smooth\" });\n }\n } else if (props.args.scroll_to_annotation) {\n const annotation = document.querySelector(`[id^=\"annotation-\"][data-index=\"${props.args.scroll_to_annotation}\"]`);\n if (annotation) {\n annotation.scrollIntoView({ behavior: \"smooth\", block: \"center\" });\n }\n }\n };\n\n const setFrameHeight = () => {\n const newHeight = props.args.height || totalHeight.value;\n if (newHeight !== currentFrameHeight.value) {\n Streamlit.setFrameHeight(newHeight);\n currentFrameHeight.value = newHeight;\n }\n };\n\n const setFrameWidth = () => {\n const result = parseWidthValue(props.args.width, window.innerWidth);\n let newMaxWidth;\n if (result.type === \"percent\") {\n newMaxWidth = Math.min(Math.floor(result.value * window.innerWidth), window.innerWidth);\n } else {\n newMaxWidth = Math.min(result.value, window.innerWidth);\n }\n\n if (newMaxWidth !== maxWidth.value) {\n maxWidth.value = newMaxWidth;\n }\n };\n\n const handleResize = async () => {\n try {\n console.log('handleResize');\n if (props.args.rendering === \"unwrap\") {\n const binaryDataUrl = `data:application/pdf;base64,${props.args.binary}`;\n setFrameWidth();\n await loadPdfs(binaryDataUrl);\n setFrameHeight();\n }\n } catch (error) {\n console.error(error);\n }\n };\n\n // Debounced resize handler to prevent multiple rapid executions\n const debouncedHandleResize = debounce(handleResize, 200);\n\n onMounted(() => {\n debouncedHandleResize();\n window.addEventListener(\"resize\", debouncedHandleResize);\n });\n\n onUnmounted(() => {\n window.removeEventListener(\"resize\", debouncedHandleResize);\n });\n\n return {\n pdfContainerStyle,\n pdfViewerStyle,\n };\n },\n};\n</script>","import { render } from \"./PdfViewer.vue?vue&type=template&id=191093ce\"\nimport script from \"./PdfViewer.vue?vue&type=script&lang=js\"\nexport * from \"./PdfViewer.vue?vue&type=script&lang=js\"\n\nimport exportComponent from \"../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createElementVNode as _createElementVNode, toDisplayString as _toDisplayString, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot } from \"vue\"\n\nconst _hoisted_1 = { key: 0 }\nconst _hoisted_2 = { class: \"err__msg\" }\n\nexport function render(_ctx: any,_cache: any,$props: any,$setup: any,$data: any,$options: any) {\n return (_openBlock(), _createElementBlock(\"div\", null, [\n (_ctx.componentError != '')\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _cache[0] || (_cache[0] = _createElementVNode(\"h1\", { class: \"err__title\" }, \"Component Error\", -1)),\n _createElementVNode(\"div\", _hoisted_2, \"Message: \" + _toDisplayString(_ctx.componentError), 1)\n ]))\n : (_ctx.renderData != null)\n ? _renderSlot(_ctx.$slots, \"default\", {\n key: 1,\n args: _ctx.renderData.args,\n disabled: _ctx.renderData.disabled\n }, undefined, true)\n : _createCommentVNode(\"\", true)\n ]))\n}","<template>\n <div>\n <!-- Error boundary. If our wrapped component threw an error, display it. -->\n <div v-if=\"componentError != ''\">\n <h1 class=\"err__title\">Component Error</h1>\n <div class=\"err__msg\">Message: {{ componentError }}</div>\n </div>\n <!-- \n Else render the component slot and pass Streamlit event data in `args` props to it.\n Don't render until we've gotten our first RENDER_EVENT from Streamlit.\n All components get disabled while the app is being re-run, and become re-enabled when the re-run has finished.\n -->\n <slot\n v-else-if=\"renderData != null\"\n :args=\"renderData.args\"\n :disabled=\"renderData.disabled\"\n ></slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport {\n ref,\n defineComponent,\n onMounted,\n onUpdated,\n onUnmounted,\n onErrorCaptured,\n} from \"vue\"\nimport { Streamlit, RenderData } from \"streamlit-component-lib\"\n\nexport default defineComponent({\n name: \"WithStreamlitConnection\",\n setup() {\n const renderData = ref<RenderData>((undefined as unknown) as RenderData)\n const componentError = ref(\"\")\n\n const onRenderEvent = (event: Event): void => {\n const renderEvent = event as CustomEvent<RenderData>\n renderData.value = renderEvent.detail\n componentError.value = \"\"\n }\n\n // Set up event listeners, and signal to Streamlit that we're ready.\n // We won't render the component until we receive the first RENDER_EVENT.\n onMounted(() => {\n Streamlit.events.addEventListener(Streamlit.RENDER_EVENT, onRenderEvent)\n Streamlit.setComponentReady()\n })\n onUpdated(() => {\n // If our slot threw an error, we display it in render(). In this\n // case, the slot won't be mounted and therefore won't call\n // `setFrameHeight` on its own. We do it here so that the rendered\n // error will be visible.\n if (componentError.value != \"\") {\n Streamlit.setFrameHeight()\n }\n })\n onUnmounted(() => {\n Streamlit.events.removeEventListener(\n Streamlit.RENDER_EVENT,\n onRenderEvent\n )\n })\n onErrorCaptured(err => {\n componentError.value = String(err)\n })\n\n return {\n renderData,\n componentError,\n }\n },\n})\n</script>\n\n<style scoped>\n.err__title,\n.err__msg {\n margin: 0;\n}\n</style>\n","import { render } from \"./WithStreamlitConnection.vue?vue&type=template&id=bef81972&scoped=true&ts=true\"\nimport script from \"./WithStreamlitConnection.vue?vue&type=script&lang=ts\"\nexport * from \"./WithStreamlitConnection.vue?vue&type=script&lang=ts\"\n\nimport \"./WithStreamlitConnection.vue?vue&type=style&index=0&id=bef81972&scoped=true&lang=css\"\n\nimport exportComponent from \"../../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render],['__scopeId',\"data-v-bef81972\"]])\n\nexport default __exports__","import { render } from \"./App.vue?vue&type=template&id=6ea7f320&ts=true\"\nimport script from \"./App.vue?vue&type=script&lang=ts\"\nexport * from \"./App.vue?vue&type=script&lang=ts\"\n\nimport \"./App.vue?vue&type=style&index=0&id=6ea7f320&lang=css\"\n\nimport exportComponent from \"../node_modules/vue-loader/dist/exportHelper.js\"\nconst __exports__ = /*#__PURE__*/exportComponent(script, [['render',render]])\n\nexport default __exports__","import { createApp } from 'vue'\nimport App from './App.vue'\n\ncreateApp(App).mount('#app')\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t524: 0\n};\n\n// no chunk on demand loading\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkstreamlit_pdf_viewer\"] = self[\"webpackChunkstreamlit_pdf_viewer\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [504], () => (__webpack_require__(9957)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["_hoisted_1","id","render","_ctx","_cache","$props","$setup","$data","$options","_component_PdfViewer","_resolveComponent","_component_WithStreamlitConnection","_openBlock","_createElementBlock","_createVNode","default","_withCtx","args","_","key","style","_normalizeStyle","pdfContainerStyle","rendering","_createElementVNode","pdfViewerStyle","_hoisted_2","src","binary","width","height","type","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","CMAP_URL","CMAP_PACKED","ENABLE_XFA","acceptedBorderStyleAttributes","undefined","props","setup","totalHeight","ref","maxWidth","pageScales","pageHeights","loadedPages","currentFrameHeight","renderText","pages_to_render","length","render_text","parseWidthValue","widthValue","fallbackValue","window","innerWidth","endsWith","num","parseFloat","isNaN","value","numeric","Number","computed","result","widthCSS","overflow","position","clearExistingCanvases","pdfViewer","innerHTML","createCanvasForPage","page","scale","rotation","pageNumber","resolutionRatioBoost","viewport","getViewport","ratio","devicePixelRatio","canvas","document","createElement","pages_vertical_spacing","display","marginBottom","getContext","renderAnnotation","annotation","pageDiv","annotationDiv","index","left","x","top","y","border","includes","outline","annotation_outline_size","color","cursor","pointerEvents","zIndex","addEventListener","Streamlit","setComponentValue","clicked_annotation","appendChild","renderPage","async","annotations","renderContext","canvasContext","promise","className","canvasWrapper","textContent","getTextContent","textLayerDiv","textLayer","pdfjsLib","textContentSource","container","textDivs","forEach","getElementById","getPagesToRender","numPages","Array","from","i","renderPdfPages","pdf","pagesToRender","resolutionBoost","resolution_boost","getPage","rotate","unscaledViewport","widthScale","possibleScaledWidth","push","setProperty","intent","annotationsForPage","filter","anno","alertError","error","alert","message","console","loadPdfs","workerSrc","loadingTask","getDocument","url","cMapUrl","cMapPacked","enableXfa","scrollToItem","scroll_to_page","scrollIntoView","behavior","scroll_to_annotation","querySelector","block","setFrameHeight","newHeight","setFrameWidth","newMaxWidth","Math","min","floor","handleResize","log","binaryDataUrl","debouncedHandleResize","debounce","onMounted","onUnmounted","removeEventListener","__exports__","class","componentError","_toDisplayString","renderData","_renderSlot","$slots","disabled","_createCommentVNode","defineComponent","name","onRenderEvent","event","renderEvent","detail","events","RENDER_EVENT","setComponentReady","onUpdated","onErrorCaptured","err","String","components","PdfViewer","WithStreamlitConnection","createApp","App","mount","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","loaded","__webpack_modules__","call","m","deferred","O","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","Object","keys","every","splice","r","d","definition","o","defineProperty","enumerable","get","g","globalThis","this","Function","e","obj","prop","prototype","hasOwnProperty","nmd","paths","children","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","data","moreModules","runtime","some","chunkLoadingGlobal","self","bind","__webpack_exports__"],"sourceRoot":""}