streamlit-pdf-viewer 0.0.18.dev0__tar.gz → 0.0.18.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.
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/.bumpversion.toml +1 -1
- {streamlit_pdf_viewer-0.0.18.dev0/streamlit_pdf_viewer.egg-info → streamlit_pdf_viewer-0.0.18.dev1}/PKG-INFO +14 -12
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/README.md +13 -11
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/index.html +1 -1
- streamlit_pdf_viewer-0.0.18.dev1/streamlit_pdf_viewer/frontend/dist/js/app.c29bbbdb.js +2 -0
- streamlit_pdf_viewer-0.0.18.dev0/streamlit_pdf_viewer/frontend/dist/js/app.a7be2fe8.js.map → streamlit_pdf_viewer-0.0.18.dev1/streamlit_pdf_viewer/frontend/dist/js/app.c29bbbdb.js.map +1 -1
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1/streamlit_pdf_viewer.egg-info}/PKG-INFO +14 -12
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer.egg-info/SOURCES.txt +2 -2
- streamlit_pdf_viewer-0.0.18.dev0/streamlit_pdf_viewer/frontend/dist/js/app.a7be2fe8.js +0 -2
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/LICENSE +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/MANIFEST.in +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/setup.cfg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/setup.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/__init__.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/css/app.1df382f3.css +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/css/chunk-vendors.8f00bdad.css +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/altText_add.7748ee93.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/altText_done.1026be11.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorFreeHighlight.1fed7bb7.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorFreeText.0b596377.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorInk.f94c2f42.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/cursor-editorTextHighlight.5636640c.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/editor-toolbar-delete.6694a89f.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/toolbarButton-editorHighlight.c3287eaa.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/img/toolbarButton-menuArrow.37a6145d.svg +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a06c44e8.js +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a06c44e8.js.map +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer.egg-info/dependency_links.txt +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer.egg-info/requires.txt +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/streamlit_pdf_viewer.egg-info/top_level.txt +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/__init__.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/e2e_utils.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_embed_height.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_embed_no_args.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_embed_width.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_embed_width_height.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_iframe_height.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_iframe_no_args.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_iframe_width.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_iframe_width_height.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_invalid_params.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_rendering_text.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_resolution_boost.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_tabs.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_tabs_2.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_unwrap_height.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_unwrap_no_args.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_unwrap_width.py +0 -0
- {streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_unwrap_width_height.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: streamlit-pdf-viewer
|
|
3
|
-
Version: 0.0.18.
|
|
3
|
+
Version: 0.0.18.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
|
|
@@ -48,17 +48,19 @@ pdf_viewer("str, path or bytes")
|
|
|
48
48
|
|
|
49
49
|
In the following table the list of parameters that can be provided to the `pdf_viewer` function:
|
|
50
50
|
|
|
51
|
-
| name | description
|
|
52
|
-
|
|
53
|
-
| input | The source of the PDF file. Accepts a file path, URL, or binary data.
|
|
54
|
-
| width | Width of the PDF viewer in pixels. It defaults to 700 pixels.
|
|
55
|
-
| height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content.
|
|
56
|
-
| annotations | A list of annotations to be overlaid on the PDF. Format is described here.
|
|
57
|
-
| pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels.
|
|
58
|
-
| annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel.
|
|
59
|
-
| 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
|
|
60
|
-
| pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered.
|
|
61
|
-
| 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.
|
|
51
|
+
| name | description |
|
|
52
|
+
|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
53
|
+
| input | The source of the PDF file. Accepts a file path, URL, or binary data. |
|
|
54
|
+
| width | Width of the PDF viewer in pixels. It defaults to 700 pixels. |
|
|
55
|
+
| height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
|
|
56
|
+
| annotations | A list of annotations to be overlaid on the PDF. Format is described here. |
|
|
57
|
+
| pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
|
|
58
|
+
| annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
|
|
59
|
+
| 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: |
|
|
60
|
+
| pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
|
|
61
|
+
| 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.
|
|
62
|
+
| scroll_to_page | Scroll to a specific page when the component is rendered. Default is None. Require ints and ignores the parameters below zero. |
|
|
63
|
+
| 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` |
|
|
62
64
|
|
|
63
65
|
|
|
64
66
|
### Annotation format
|
|
@@ -34,17 +34,19 @@ pdf_viewer("str, path or bytes")
|
|
|
34
34
|
|
|
35
35
|
In the following table the list of parameters that can be provided to the `pdf_viewer` function:
|
|
36
36
|
|
|
37
|
-
| name | description
|
|
38
|
-
|
|
39
|
-
| input | The source of the PDF file. Accepts a file path, URL, or binary data.
|
|
40
|
-
| width | Width of the PDF viewer in pixels. It defaults to 700 pixels.
|
|
41
|
-
| height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content.
|
|
42
|
-
| annotations | A list of annotations to be overlaid on the PDF. Format is described here.
|
|
43
|
-
| pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels.
|
|
44
|
-
| annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel.
|
|
45
|
-
| 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
|
|
46
|
-
| pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered.
|
|
47
|
-
| 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.
|
|
37
|
+
| name | description |
|
|
38
|
+
|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
39
|
+
| input | The source of the PDF file. Accepts a file path, URL, or binary data. |
|
|
40
|
+
| width | Width of the PDF viewer in pixels. It defaults to 700 pixels. |
|
|
41
|
+
| height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
|
|
42
|
+
| annotations | A list of annotations to be overlaid on the PDF. Format is described here. |
|
|
43
|
+
| pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
|
|
44
|
+
| annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
|
|
45
|
+
| 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: |
|
|
46
|
+
| pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
|
|
47
|
+
| 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.
|
|
48
|
+
| scroll_to_page | Scroll to a specific page when the component is rendered. Default is None. Require ints and ignores the parameters below zero. |
|
|
49
|
+
| 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` |
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
### Annotation format
|
|
@@ -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.a06c44e8.js"></script><script defer="defer" src="js/app.
|
|
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.a06c44e8.js"></script><script defer="defer" src="js/app.c29bbbdb.js"></script><link href="css/chunk-vendors.8f00bdad.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={4760:(e,t,a)=>{var n=a(3751),r=a(641);const i={id:"app"};function o(e,t,a,n,o,s){const l=(0,r.g2)("PdfViewer"),d=(0,r.g2)("WithStreamlitConnection");return(0,r.uX)(),(0,r.CE)("div",i,[(0,r.bF)(d,null,{default:(0,r.k6)((({args:e})=>[(0,r.bF)(l,{args:e},null,8,["args"])])),_:1})])}var s=a(33);const l={key:0},d={key:0,id:"pdfAnnotations"},p=["id"],g={key:1},c=["src","width","height"],u={key:2},h=["src","width","height"],v={key:3};function w(e,t,a,n,i,o){return(0,r.uX)(),(0,r.CE)("div",{id:"pdfContainer",style:(0,s.Tr)(n.pdfContainerStyle)},["unwrap"===a.args.rendering?((0,r.uX)(),(0,r.CE)("div",l,[(0,r.Lk)("div",{id:"pdfViewer",style:(0,s.Tr)(n.pdfViewerStyle)},[a.args.annotations?((0,r.uX)(),(0,r.CE)("div",d,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(n.filteredAnnotations,((e,t)=>((0,r.uX)(),(0,r.CE)("div",{key:t,style:(0,s.Tr)(n.getPageStyle)},[(0,r.Lk)("div",{style:(0,s.Tr)(n.getAnnotationStyle(e,t)),id:`annotation-${t}`},null,12,p)],4)))),128))])):(0,r.Q3)("",!0)],4)])):"legacy_embed"===a.args.rendering?((0,r.uX)(),(0,r.CE)("div",g,[(0,r.Lk)("embed",{src:`data:application/pdf;base64,${a.args.binary}`,width:`${a.args.width}`,height:`${a.args.height}`,type:"application/pdf"},null,8,c)])):"legacy_iframe"===a.args.rendering?((0,r.uX)(),(0,r.CE)("div",u,[(0,r.Lk)("embed",{src:`data:application/pdf;base64,${a.args.binary}`,width:`${a.args.width}`,height:`${a.args.height}`,type:"application/pdf"},null,8,h)])):((0,r.uX)(),(0,r.CE)("div",v," Error rendering option. "))],4)}a(4114),a(7642),a(8004),a(3853),a(5876),a(2475),a(5024),a(1698);var f=a(953),m=(a(7566),a(4883)),y=a(7445);const _="pdfjs-dist/cmaps/",E=!0,b=!0,C={props:["args"],setup(e){const t=(0,f.KR)(0),a=(0,f.KR)(0),n=(0,f.KR)([]),i=(0,f.KR)([]),o=(0,f.KR)([]),s=(0,f.KR)([]),l=0===e.args.pages_to_render.length,d=(0,r.EW)((()=>l?e.args.annotations:e.args.annotations.filter((t=>e.args.pages_to_render.includes(Number(t.page)))))),p=!0===e.args.render_text,g=(0,r.EW)((()=>({width:e.args.width?`${e.args.width}px`:`${a.value}px`,height:e.args.height?`${e.args.height}px`:"auto",overflow:"auto"}))),c={position:"relative"},u={position:"relative"},h=t=>{let a=0;if(l)for(let r=0;r<t-1;r++)a+=i.value[r]*n.value[r]+e.args.pages_vertical_spacing;else for(let r=0;r<i.value.length;r++)e.args.pages_to_render.includes(r+1)&&r<t-1&&(a+=i.value[r]*n.value[r]+e.args.pages_vertical_spacing);return a},v=(t,a)=>{const r=n.value[t.page-1],i={position:"absolute",left:t.x*r+"px",top:`${h(t.page)+t.y*r}px`,width:t.width*r+"px",height:t.height*r+"px",outline:e.args.annotation_outline_size*r+"px solid",outlineColor:t.color,cursor:"pointer","z-index":1};return a&&s.value.push(`annotation-${a}`),i},w=e=>{const t=e?.getElementsByTagName("canvas");for(let a=t.length-1;a>=0;a--)e?.removeChild(t.item(a))},C=(t,a,n,r,i=1)=>{const o=t.getViewport({scale:a,rotation:n}),s=(window.devicePixelRatio||1)*i,l=document.createElement("canvas");return l.id=`canvas_page_${r}`,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},k=async(e,t,a)=>{const n={canvasContext:t.getContext("2d"),viewport:a},r=e.render(n);if(await r.promise,p){const n=await e.getTextContent(),r=document.createElement("div");r.className="textLayer",r.style="z-index: 2";const i=new m.D6({textContentSource:n,container:r,viewport:a,textDivs:[]});await i.render();const o=document.createElement("div");o.className="page";const s=document.createElement("div");s.className="canvasWrapper",s.appendChild(t),o.style="position: relative;";const l=document.getElementById("pdfViewer");o.appendChild(s),o.appendChild(r),l.appendChild(o)}else{const e=document.createElement("div");e.className="page";const a=document.createElement("div");a.className="canvasWrapper",a.appendChild(t),e.style="position: relative;",e.appendChild(a),pdfViewer.appendChild(e)}},x=async(r,s,l=null)=>{if(0===l.length){l=[];for(let e=0;e<r.numPages;e++)l.push(e+1)}let d=1;e.args.resolution_boost&&(d=e.args.resolution_boost);for(let p=1;p<=r.numPages;p++){const g=await r.getPage(p),c=g.rotate,u=g.getViewport({scale:1,rotation:c});if(e.args.height>0){const t=u.width/u.height,n=t*e.args.height;(0===a.value||n<a.value)&&(a.value=n)}const h=a.value/u.width;if(n.value.push(h),i.value.push(u.height),l.includes(p)){const e=C(g,h,c,p,d);s.style.setProperty("--scale-factor",h);const a=g.getViewport({scale:n.value[g._pageIndex],rotation:g.rotate,intent:"print"}),r=(window.devicePixelRatio||1)*d;t.value+=e.height/r,await k(g,e,a),void 0!==e.id&&o.value.push(e.id)}}l.length>0&&(t.value-=e.args.pages_vertical_spacing)},$=e=>{window.alert(e.message),console.error(e)},R=async t=>{try{const a=await(0,m.YE)({url:t,cMapUrl:_,cMapPacked:E,enableXfa:b}),n=document.getElementById("pdfViewer");w(n);const r=await a.promise;await x(r,n,e.args.pages_to_render)}catch(a){$(a)}},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.getElementById("annotation-"+(e.args.scroll_to_annotation-1));t&&t.scrollIntoView({behavior:"smooth",block:"center"})}},S=()=>{const e=new Set,t=new Set;let a;for(a=0;a<s.value.length;a++)t.add(s.value[a]);for(a=0;a<o.value.length;a++)e.add(o.value[a]);y.wk.setComponentValue({pages:Array.from(e),annotations:Array.from(t)})},P=()=>{y.wk.setFrameHeight(e.args.height||t.value)},N=()=>{null===e.args.width||void 0===e.args.width?a.value=window.innerWidth:Number.isInteger(e.args.width)&&(a.value=e.args.width,window.innerWidth>0&&window.innerWidth<a.value&&(a.value=window.innerWidth))};return(0,r.sV)((()=>{const t=`data:application/pdf;base64,${e.args.binary}`;N(),"unwrap"===e.args.rendering?R(t).then(P).then(S).then(y.wk.setComponentReady):(P(),y.wk.setComponentReady())})),(0,r.$u)((()=>{P(),"unwrap"===e.args.rendering&&V()})),{filteredAnnotations:d,getAnnotationStyle:v,pdfContainerStyle:g,pdfViewerStyle:c,getPageStyle:u}}};var k=a(6262);const x=(0,k.A)(C,[["render",w]]),$=x,R=e=>((0,r.Qi)("data-v-bef81972"),e=e(),(0,r.jt)(),e),V={key:0},S=R((()=>(0,r.Lk)("h1",{class:"err__title"},"Component Error",-1))),P={class:"err__msg"};function N(e,t,a,n,i,o){return(0,r.uX)(),(0,r.CE)("div",null,[""!=e.componentError?((0,r.uX)(),(0,r.CE)("div",V,[S,(0,r.Lk)("div",P,"Message: "+(0,s.v_)(e.componentError),1)])):null!=e.renderData?(0,r.RG)(e.$slots,"default",{key:1,args:e.renderData.args,disabled:e.renderData.disabled},void 0,!0):(0,r.Q3)("",!0)])}const X=(0,r.pM)({name:"WithStreamlitConnection",setup(){const e=(0,f.KR)(void 0),t=(0,f.KR)(""),a=a=>{const n=a;e.value=n.detail,t.value=""};return(0,r.sV)((()=>{y.wk.events.addEventListener(y.wk.RENDER_EVENT,a),y.wk.setComponentReady()})),(0,r.$u)((()=>{""!=t.value&&y.wk.setFrameHeight()})),(0,r.hi)((()=>{y.wk.events.removeEventListener(y.wk.RENDER_EVENT,a)})),(0,r.qG)((e=>{t.value=String(e)})),{renderData:e,componentError:t}}}),A=(0,k.A)(X,[["render",N],["__scopeId","data-v-bef81972"]]),O=A,W=(0,r.pM)({name:"App",components:{PdfViewer:$,WithStreamlitConnection:O}}),I=(0,k.A)(W,[["render",o]]),T=I;(0,n.Ef)(T).mount("#app")}},t={};function a(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,a),i.exports}a.m=e,(()=>{var e=[];a.O=(t,n,r,i)=>{if(!n){var o=1/0;for(p=0;p<e.length;p++){for(var[n,r,i]=e[p],s=!0,l=0;l<n.length;l++)(!1&i||o>=i)&&Object.keys(a.O).every((e=>a.O[e](n[l])))?n.splice(l--,1):(s=!1,i<o&&(o=i));if(s){e.splice(p--,1);var d=r();void 0!==d&&(t=d)}}return t}i=i||0;for(var p=e.length;p>0&&e[p-1][2]>i;p--)e[p]=e[p-1];e[p]=[n,r,i]}})(),(()=>{a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{a.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()})(),(()=>{a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{var e={524:0};a.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[o,s,l]=n,d=0;if(o.some((t=>0!==e[t]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(l)var p=l(a)}for(t&&t(n);d<o.length;d++)i=o[d],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(p)},n=self["webpackChunkstreamlit_pdf_viewer"]=self["webpackChunkstreamlit_pdf_viewer"]||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var n=a.O(void 0,[504],(()=>a(4760)));n=a.O(n)})();
|
|
2
|
+
//# sourceMappingURL=app.c29bbbdb.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"js/app.a7be2fe8.js","mappings":"gEAEA,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,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AxB4G,EAAoBwB,EAAI,CAAC7J,EAAKsK,IAAUhB,OAAOiB,UAAUC,eAAe7B,KAAK3I,EAAKsK,E,WCKlF,IAAIG,EAAkB,CACrB,IAAK,GAaNpC,EAAoBS,EAAE/H,EAAK2J,GAA0C,IAA7BD,EAAgBC,GAGxD,IAAIC,EAAuB,CAACC,EAA4BC,KACvD,IAGIvC,EAAUoC,GAHT1B,EAAU8B,EAAaC,GAAWF,EAGhBjL,EAAI,EAC3B,GAAGoJ,EAASgC,MAAM7P,GAAgC,IAAxBsP,EAAgBtP,KAAa,CACtD,IAAImN,KAAYwC,EACZzC,EAAoBwB,EAAEiB,EAAaxC,KACrCD,EAAoBO,EAAEN,GAAYwC,EAAYxC,IAGhD,GAAGyC,EAAS,IAAIhC,EAASgC,EAAQ1C,EAClC,CAEA,IADGuC,GAA4BA,EAA2BC,GACrDjL,EAAIoJ,EAASjK,OAAQa,IACzB8K,EAAU1B,EAASpJ,GAChByI,EAAoBwB,EAAEY,EAAiBC,IAAYD,EAAgBC,IACrED,EAAgBC,GAAS,KAE1BD,EAAgBC,GAAW,EAE5B,OAAOrC,EAAoBS,EAAEC,EAAO,EAGjCkC,EAAqBC,KAAK,oCAAsCA,KAAK,qCAAuC,GAChHD,EAAmBE,QAAQR,EAAqBS,KAAK,KAAM,IAC3DH,EAAmBvK,KAAOiK,EAAqBS,KAAK,KAAMH,EAAmBvK,KAAK0K,KAAKH,G,KC7CvF,IAAII,EAAsBhD,EAAoBS,OAAE5E,EAAW,CAAC,MAAM,IAAOmE,EAAoB,QAC7FgD,EAAsBhD,EAAoBS,EAAEuC,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/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\">\n <div id=\"pdfAnnotations\" v-if=\"args.annotations\">\n <div v-for=\"(annotation, index) in filteredAnnotations\" :key=\"index\" :style=\"getPageStyle\">\n <div :style=\"getAnnotationStyle(annotation, index)\" :id=\"`annotation-${index}`\"></div>\n </div>\n </div>\n </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}`\" 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}`\" 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} 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\";\n\nconst CMAP_URL = \"pdfjs-dist/cmaps/\";\nconst CMAP_PACKED = true;\nconst ENABLE_XFA = true;\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 loadedAnnotations = ref([]);\n\n const isRenderingAllPages = props.args.pages_to_render.length === 0;\n\n const filteredAnnotations = computed(() => {\n if (isRenderingAllPages) {\n return props.args.annotations;\n }\n return props.args.annotations.filter(anno => {\n return props.args.pages_to_render.includes(Number(anno.page))\n })\n });\n\n const renderText = props.args.render_text === true\n\n const pdfContainerStyle = computed(() => ({\n width: props.args.width ? `${props.args.width}px` : `${maxWidth.value}px`,\n height: props.args.height ? `${props.args.height}px` : 'auto',\n overflow: 'auto',\n }));\n\n const pdfViewerStyle = {position: 'relative'};\n const getPageStyle = {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; // Add margin for each page\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 getAnnotationStyle = (annoObj, index) => {\n const scale = pageScales.value[annoObj.page - 1];\n const obj = {\n position: 'absolute',\n left: `${annoObj.x * scale}px`,\n top: `${calculatePdfsHeight(annoObj.page) + annoObj.y * scale}px`,\n width: `${annoObj.width * scale}px`,\n height: `${annoObj.height * scale}px`,\n outline: `${props.args.annotation_outline_size * scale}px solid`,\n outlineColor: annoObj.color,\n cursor: 'pointer',\n 'z-index': 10\n };\n if (index) {\n loadedAnnotations.value.push(`annotation-${index}`);\n }\n return obj\n };\n\n const clearExistingCanvases = (pdfViewer) => {\n const canvases = pdfViewer?.getElementsByTagName(\"canvas\");\n for (let j = canvases.length - 1; j >= 0; j--) {\n pdfViewer?.removeChild(canvases.item(j));\n }\n };\n\n const createCanvasForPage = (page, scale, rotation, pageNumber, resolutionRatioBoost=1) => {\n const viewport = page.getViewport({scale, rotation});\n\n const ratio = (window.devicePixelRatio || 1) * resolutionRatioBoost\n // console.log(ratio)\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 return canvas;\n };\n\n\n const renderPage = async (page, canvas, viewport) => {\n const renderContext = {\n canvasContext: canvas.getContext(\"2d\"),\n viewport: viewport\n };\n const renderTask = page.render(renderContext);\n await renderTask.promise;\n\n if (renderText) {\n const textContent = await page.getTextContent();\n const textLayerDiv = document.createElement(\"div\");\n textLayerDiv.className = \"textLayer\"\n // textLayerDiv.style.position = \"absolute\";\n // textLayerDiv.style.height = `${viewport.height}px`;\n // textLayerDiv.style.width = `${viewport.width}px`;\n const textLayer = new pdfjsLib.TextLayer({\n textContentSource: textContent,\n container: textLayerDiv,\n viewport: viewport,\n textDivs: []\n })\n await textLayer.render()\n\n const pageDiv = document.createElement('div');\n pageDiv.className = 'page';\n\n const canvasWrapper = document.createElement('div');\n canvasWrapper.className = 'canvasWrapper';\n canvasWrapper.appendChild(canvas);\n\n pageDiv.style = \"position: relative;\";\n\n const pdfViewer = document.getElementById(\"pdfViewer\");\n pageDiv.appendChild(canvasWrapper);\n pageDiv.appendChild(textLayerDiv);\n\n pdfViewer.appendChild(pageDiv);\n } else {\n const pageDiv = document.createElement('div');\n pageDiv.className = 'page';\n\n const canvasWrapper = document.createElement('div');\n canvasWrapper.className = 'canvasWrapper';\n canvasWrapper.appendChild(canvas);\n\n pageDiv.style = \"position: relative;\";\n pageDiv.appendChild(canvasWrapper);\n pdfViewer.appendChild(pageDiv);\n }\n };\n\n const renderPdfPages = async (pdf, pdfViewer, pagesToRender = null) => {\n if (pagesToRender.length === 0) {\n pagesToRender = []\n for (let i = 0; i < pdf.numPages; i++) {\n pagesToRender.push(i + 1);\n }\n }\n\n let resolutionBoost = 1\n if (props.args.resolution_boost) {\n resolutionBoost = props.args.resolution_boost\n }\n\n for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {\n const page = await pdf.getPage(pageNumber)\n const rotation = page.rotate\n // Initial viewport\n const unscaledViewport = page.getViewport({\n scale: 1.0,\n rotation: rotation,\n })\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) {\n maxWidth.value = possibleScaledWidth\n } else if (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 if (pagesToRender.includes(pageNumber)) {\n const canvas = createCanvasForPage(page, scale, rotation, pageNumber, resolutionBoost)\n\n // pdfViewer?.append(canvas)\n pdfViewer.style.setProperty('--scale-factor', scale);\n\n const viewport = page.getViewport({\n scale: pageScales.value[page._pageIndex],\n rotation: page.rotate,\n intent: \"print\",\n });\n\n const ratio = (window.devicePixelRatio || 1) * resolutionBoost\n totalHeight.value += canvas.height / ratio\n await renderPage(page, canvas, viewport)\n if (canvas.id !== undefined) {\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 try {\n const loadingTask = await getDocument({\n \"url\": url,\n \"cMapUrl\": CMAP_URL,\n \"cMapPacked\": CMAP_PACKED,\n \"enableXfa\": ENABLE_XFA,\n });\n const pdfViewer = document.getElementById(\"pdfViewer\");\n clearExistingCanvases(pdfViewer);\n\n const pdf = await loadingTask.promise;\n await renderPdfPages(pdf, pdfViewer, props.args.pages_to_render);\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.getElementById(`annotation-${props.args.scroll_to_annotation - 1}`);\n if (annotation) {\n annotation.scrollIntoView({behavior: \"smooth\", block: \"center\"});\n }\n }\n };\n\n const collectAndReturnIds = () => {\n const pages_ids = new Set()\n const annotations_ids = new Set()\n\n let j\n\n for (j = 0; j < loadedAnnotations.value.length; j++) {\n annotations_ids.add(loadedAnnotations.value[j]);\n }\n for (j = 0; j < loadedPages.value.length; j++) {\n pages_ids.add(loadedPages.value[j]);\n }\n\n Streamlit.setComponentValue({\"pages\": Array.from(pages_ids), \"annotations\": Array.from(annotations_ids)})\n }\n\n\n const setFrameHeight = () => {\n Streamlit.setFrameHeight(props.args.height || totalHeight.value);\n };\n\n const setFrameWidth = () => {\n if (props.args.width === null || props.args.width === undefined) {\n maxWidth.value = window.innerWidth\n } else if (Number.isInteger(props.args.width)) {\n maxWidth.value = props.args.width\n\n // If the desired width is larger than the available inner width,\n // we should not exceed it. To be revised\n if (window.innerWidth > 0) {\n if (window.innerWidth < maxWidth.value) {\n maxWidth.value = window.innerWidth\n }\n }\n }\n }\n\n onMounted(() => {\n const binaryDataUrl = `data:application/pdf;base64,${props.args.binary}`;\n setFrameWidth();\n if (props.args.rendering === \"unwrap\") {\n loadPdfs(binaryDataUrl)\n .then(setFrameHeight)\n .then(collectAndReturnIds)\n .then(Streamlit.setComponentReady);\n } else {\n setFrameHeight();\n Streamlit.setComponentReady();\n }\n });\n\n onUpdated(() => {\n setFrameHeight();\n if (props.args.rendering === \"unwrap\") {\n scrollToItem();\n }\n });\n\n\n return {\n filteredAnnotations,\n getAnnotationStyle,\n pdfContainerStyle,\n pdfViewerStyle,\n getPageStyle\n };\n },\n};\n</script>\n","import { render } from \"./PdfViewer.vue?vue&type=template&id=346428be\"\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, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = (n: any) => (_pushScopeId(\"data-v-bef81972\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { key: 0 }\nconst _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"h1\", { class: \"err__title\" }, \"Component Error\", -1))\nconst _hoisted_3 = { 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 _hoisted_2,\n _createElementVNode(\"div\", _hoisted_3, \"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\t// no module.id needed\n\t\t// no module.loaded needed\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// 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))","// 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__(9282)))\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","annotations","_hoisted_2","_Fragment","_renderList","filteredAnnotations","annotation","index","getPageStyle","getAnnotationStyle","_hoisted_3","_createCommentVNode","_hoisted_4","src","binary","width","height","type","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","CMAP_URL","CMAP_PACKED","ENABLE_XFA","props","setup","totalHeight","ref","maxWidth","pageScales","pageHeights","loadedPages","loadedAnnotations","isRenderingAllPages","pages_to_render","length","computed","filter","anno","includes","Number","page","renderText","render_text","value","overflow","position","calculatePdfsHeight","i","pages_vertical_spacing","annoObj","scale","obj","left","x","top","y","outline","annotation_outline_size","outlineColor","color","cursor","push","clearExistingCanvases","pdfViewer","canvases","getElementsByTagName","j","removeChild","item","createCanvasForPage","rotation","pageNumber","resolutionRatioBoost","viewport","getViewport","ratio","window","devicePixelRatio","canvas","document","createElement","display","marginBottom","getContext","renderPage","async","renderContext","canvasContext","renderTask","promise","textContent","getTextContent","textLayerDiv","className","textLayer","pdfjsLib","textContentSource","container","textDivs","pageDiv","canvasWrapper","appendChild","getElementById","renderPdfPages","pdf","pagesToRender","numPages","resolutionBoost","resolution_boost","getPage","rotate","unscaledViewport","widthScale","possibleScaledWidth","setProperty","_pageIndex","intent","undefined","alertError","error","alert","message","console","loadPdfs","loadingTask","getDocument","url","scrollToItem","scroll_to_page","scrollIntoView","behavior","scroll_to_annotation","block","collectAndReturnIds","pages_ids","Set","annotations_ids","add","Streamlit","setComponentValue","Array","from","setFrameHeight","setFrameWidth","innerWidth","isInteger","onMounted","binaryDataUrl","then","setComponentReady","onUpdated","__exports__","_withScopeId","n","_pushScopeId","_popScopeId","class","componentError","_toDisplayString","renderData","_renderSlot","$slots","disabled","defineComponent","name","onRenderEvent","event","renderEvent","detail","events","addEventListener","RENDER_EVENT","onUnmounted","removeEventListener","onErrorCaptured","err","String","components","PdfViewer","WithStreamlitConnection","createApp","App","mount","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","call","m","deferred","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","Object","keys","every","splice","r","d","definition","o","defineProperty","enumerable","get","g","globalThis","this","Function","e","prop","prototype","hasOwnProperty","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","data","moreModules","runtime","some","chunkLoadingGlobal","self","forEach","bind","__webpack_exports__"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"js/app.c29bbbdb.js","mappings":"gEAEA,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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CACA,CAPuB,E,WCAxB4G,EAAoBwB,EAAI,CAAC7J,EAAKsK,IAAUhB,OAAOiB,UAAUC,eAAe7B,KAAK3I,EAAKsK,E,WCKlF,IAAIG,EAAkB,CACrB,IAAK,GAaNpC,EAAoBS,EAAE/H,EAAK2J,GAA0C,IAA7BD,EAAgBC,GAGxD,IAAIC,EAAuB,CAACC,EAA4BC,KACvD,IAGIvC,EAAUoC,GAHT1B,EAAU8B,EAAaC,GAAWF,EAGhBjL,EAAI,EAC3B,GAAGoJ,EAASgC,MAAM7P,GAAgC,IAAxBsP,EAAgBtP,KAAa,CACtD,IAAImN,KAAYwC,EACZzC,EAAoBwB,EAAEiB,EAAaxC,KACrCD,EAAoBO,EAAEN,GAAYwC,EAAYxC,IAGhD,GAAGyC,EAAS,IAAIhC,EAASgC,EAAQ1C,EAClC,CAEA,IADGuC,GAA4BA,EAA2BC,GACrDjL,EAAIoJ,EAASjK,OAAQa,IACzB8K,EAAU1B,EAASpJ,GAChByI,EAAoBwB,EAAEY,EAAiBC,IAAYD,EAAgBC,IACrED,EAAgBC,GAAS,KAE1BD,EAAgBC,GAAW,EAE5B,OAAOrC,EAAoBS,EAAEC,EAAO,EAGjCkC,EAAqBC,KAAK,oCAAsCA,KAAK,qCAAuC,GAChHD,EAAmBE,QAAQR,EAAqBS,KAAK,KAAM,IAC3DH,EAAmBvK,KAAOiK,EAAqBS,KAAK,KAAMH,EAAmBvK,KAAK0K,KAAKH,G,KC7CvF,IAAII,EAAsBhD,EAAoBS,OAAE5E,EAAW,CAAC,MAAM,IAAOmE,EAAoB,QAC7FgD,EAAsBhD,EAAoBS,EAAEuC,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/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\">\n <div id=\"pdfAnnotations\" v-if=\"args.annotations\">\n <div v-for=\"(annotation, index) in filteredAnnotations\" :key=\"index\" :style=\"getPageStyle\">\n <div :style=\"getAnnotationStyle(annotation, index)\" :id=\"`annotation-${index}`\"></div>\n </div>\n </div>\n </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}`\" 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}`\" 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} 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\";\n\nconst CMAP_URL = \"pdfjs-dist/cmaps/\";\nconst CMAP_PACKED = true;\nconst ENABLE_XFA = true;\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 loadedAnnotations = ref([]);\n\n const isRenderingAllPages = props.args.pages_to_render.length === 0;\n\n const filteredAnnotations = computed(() => {\n if (isRenderingAllPages) {\n return props.args.annotations;\n }\n return props.args.annotations.filter(anno => {\n return props.args.pages_to_render.includes(Number(anno.page))\n })\n });\n\n const renderText = props.args.render_text === true\n\n const pdfContainerStyle = computed(() => ({\n width: props.args.width ? `${props.args.width}px` : `${maxWidth.value}px`,\n height: props.args.height ? `${props.args.height}px` : 'auto',\n overflow: 'auto',\n }));\n\n const pdfViewerStyle = {position: 'relative'};\n const getPageStyle = {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; // Add margin for each page\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 getAnnotationStyle = (annoObj, index) => {\n const scale = pageScales.value[annoObj.page - 1];\n const obj = {\n position: 'absolute',\n left: `${annoObj.x * scale}px`,\n top: `${calculatePdfsHeight(annoObj.page) + annoObj.y * scale}px`,\n width: `${annoObj.width * scale}px`,\n height: `${annoObj.height * scale}px`,\n outline: `${props.args.annotation_outline_size * scale}px solid`,\n outlineColor: annoObj.color,\n cursor: 'pointer',\n 'z-index': 1\n };\n if (index) {\n loadedAnnotations.value.push(`annotation-${index}`);\n }\n return obj\n };\n\n const clearExistingCanvases = (pdfViewer) => {\n const canvases = pdfViewer?.getElementsByTagName(\"canvas\");\n for (let j = canvases.length - 1; j >= 0; j--) {\n pdfViewer?.removeChild(canvases.item(j));\n }\n };\n\n const createCanvasForPage = (page, scale, rotation, pageNumber, resolutionRatioBoost=1) => {\n const viewport = page.getViewport({scale, rotation});\n\n const ratio = (window.devicePixelRatio || 1) * resolutionRatioBoost\n // console.log(ratio)\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 return canvas;\n };\n\n\n const renderPage = async (page, canvas, viewport) => {\n const renderContext = {\n canvasContext: canvas.getContext(\"2d\"),\n viewport: viewport\n };\n const renderTask = page.render(renderContext);\n await renderTask.promise;\n\n if (renderText) {\n const textContent = await page.getTextContent();\n const textLayerDiv = document.createElement(\"div\");\n textLayerDiv.className = \"textLayer\"\n textLayerDiv.style = \"z-index: 2\"\n // textLayerDiv.style.position = \"absolute\";\n // textLayerDiv.style.height = `${viewport.height}px`;\n // textLayerDiv.style.width = `${viewport.width}px`;\n const textLayer = new pdfjsLib.TextLayer({\n textContentSource: textContent,\n container: textLayerDiv,\n viewport: viewport,\n textDivs: []\n })\n await textLayer.render()\n\n const pageDiv = document.createElement('div');\n pageDiv.className = 'page';\n\n const canvasWrapper = document.createElement('div');\n canvasWrapper.className = 'canvasWrapper';\n canvasWrapper.appendChild(canvas);\n\n pageDiv.style = \"position: relative;\";\n\n const pdfViewer = document.getElementById(\"pdfViewer\");\n pageDiv.appendChild(canvasWrapper);\n pageDiv.appendChild(textLayerDiv);\n\n pdfViewer.appendChild(pageDiv);\n } else {\n const pageDiv = document.createElement('div');\n pageDiv.className = 'page';\n\n const canvasWrapper = document.createElement('div');\n canvasWrapper.className = 'canvasWrapper';\n canvasWrapper.appendChild(canvas);\n\n pageDiv.style = \"position: relative;\";\n pageDiv.appendChild(canvasWrapper);\n pdfViewer.appendChild(pageDiv);\n }\n };\n\n const renderPdfPages = async (pdf, pdfViewer, pagesToRender = null) => {\n if (pagesToRender.length === 0) {\n pagesToRender = []\n for (let i = 0; i < pdf.numPages; i++) {\n pagesToRender.push(i + 1);\n }\n }\n\n let resolutionBoost = 1\n if (props.args.resolution_boost) {\n resolutionBoost = props.args.resolution_boost\n }\n\n for (let pageNumber = 1; pageNumber <= pdf.numPages; pageNumber++) {\n const page = await pdf.getPage(pageNumber)\n const rotation = page.rotate\n // Initial viewport\n const unscaledViewport = page.getViewport({\n scale: 1.0,\n rotation: rotation,\n })\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) {\n maxWidth.value = possibleScaledWidth\n } else if (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 if (pagesToRender.includes(pageNumber)) {\n const canvas = createCanvasForPage(page, scale, rotation, pageNumber, resolutionBoost)\n\n // pdfViewer?.append(canvas)\n pdfViewer.style.setProperty('--scale-factor', scale);\n\n const viewport = page.getViewport({\n scale: pageScales.value[page._pageIndex],\n rotation: page.rotate,\n intent: \"print\",\n });\n\n const ratio = (window.devicePixelRatio || 1) * resolutionBoost\n totalHeight.value += canvas.height / ratio\n await renderPage(page, canvas, viewport)\n if (canvas.id !== undefined) {\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 try {\n const loadingTask = await getDocument({\n \"url\": url,\n \"cMapUrl\": CMAP_URL,\n \"cMapPacked\": CMAP_PACKED,\n \"enableXfa\": ENABLE_XFA,\n });\n const pdfViewer = document.getElementById(\"pdfViewer\");\n clearExistingCanvases(pdfViewer);\n\n const pdf = await loadingTask.promise;\n await renderPdfPages(pdf, pdfViewer, props.args.pages_to_render);\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.getElementById(`annotation-${props.args.scroll_to_annotation - 1}`);\n if (annotation) {\n annotation.scrollIntoView({behavior: \"smooth\", block: \"center\"});\n }\n }\n };\n\n const collectAndReturnIds = () => {\n const pages_ids = new Set()\n const annotations_ids = new Set()\n\n let j\n\n for (j = 0; j < loadedAnnotations.value.length; j++) {\n annotations_ids.add(loadedAnnotations.value[j]);\n }\n for (j = 0; j < loadedPages.value.length; j++) {\n pages_ids.add(loadedPages.value[j]);\n }\n\n Streamlit.setComponentValue({\"pages\": Array.from(pages_ids), \"annotations\": Array.from(annotations_ids)})\n }\n\n\n const setFrameHeight = () => {\n Streamlit.setFrameHeight(props.args.height || totalHeight.value);\n };\n\n const setFrameWidth = () => {\n if (props.args.width === null || props.args.width === undefined) {\n maxWidth.value = window.innerWidth\n } else if (Number.isInteger(props.args.width)) {\n maxWidth.value = props.args.width\n\n // If the desired width is larger than the available inner width,\n // we should not exceed it. To be revised\n if (window.innerWidth > 0) {\n if (window.innerWidth < maxWidth.value) {\n maxWidth.value = window.innerWidth\n }\n }\n }\n }\n\n onMounted(() => {\n const binaryDataUrl = `data:application/pdf;base64,${props.args.binary}`;\n setFrameWidth();\n if (props.args.rendering === \"unwrap\") {\n loadPdfs(binaryDataUrl)\n .then(setFrameHeight)\n .then(collectAndReturnIds)\n .then(Streamlit.setComponentReady);\n } else {\n setFrameHeight();\n Streamlit.setComponentReady();\n }\n });\n\n onUpdated(() => {\n setFrameHeight();\n if (props.args.rendering === \"unwrap\") {\n scrollToItem();\n }\n });\n\n\n return {\n filteredAnnotations,\n getAnnotationStyle,\n pdfContainerStyle,\n pdfViewerStyle,\n getPageStyle\n };\n },\n};\n</script>\n","import { render } from \"./PdfViewer.vue?vue&type=template&id=0caed584\"\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, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = (n: any) => (_pushScopeId(\"data-v-bef81972\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { key: 0 }\nconst _hoisted_2 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"h1\", { class: \"err__title\" }, \"Component Error\", -1))\nconst _hoisted_3 = { 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 _hoisted_2,\n _createElementVNode(\"div\", _hoisted_3, \"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\t// no module.id needed\n\t\t// no module.loaded needed\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// 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))","// 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__(4760)))\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","annotations","_hoisted_2","_Fragment","_renderList","filteredAnnotations","annotation","index","getPageStyle","getAnnotationStyle","_hoisted_3","_createCommentVNode","_hoisted_4","src","binary","width","height","type","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","CMAP_URL","CMAP_PACKED","ENABLE_XFA","props","setup","totalHeight","ref","maxWidth","pageScales","pageHeights","loadedPages","loadedAnnotations","isRenderingAllPages","pages_to_render","length","computed","filter","anno","includes","Number","page","renderText","render_text","value","overflow","position","calculatePdfsHeight","i","pages_vertical_spacing","annoObj","scale","obj","left","x","top","y","outline","annotation_outline_size","outlineColor","color","cursor","push","clearExistingCanvases","pdfViewer","canvases","getElementsByTagName","j","removeChild","item","createCanvasForPage","rotation","pageNumber","resolutionRatioBoost","viewport","getViewport","ratio","window","devicePixelRatio","canvas","document","createElement","display","marginBottom","getContext","renderPage","async","renderContext","canvasContext","renderTask","promise","textContent","getTextContent","textLayerDiv","className","textLayer","pdfjsLib","textContentSource","container","textDivs","pageDiv","canvasWrapper","appendChild","getElementById","renderPdfPages","pdf","pagesToRender","numPages","resolutionBoost","resolution_boost","getPage","rotate","unscaledViewport","widthScale","possibleScaledWidth","setProperty","_pageIndex","intent","undefined","alertError","error","alert","message","console","loadPdfs","loadingTask","getDocument","url","scrollToItem","scroll_to_page","scrollIntoView","behavior","scroll_to_annotation","block","collectAndReturnIds","pages_ids","Set","annotations_ids","add","Streamlit","setComponentValue","Array","from","setFrameHeight","setFrameWidth","innerWidth","isInteger","onMounted","binaryDataUrl","then","setComponentReady","onUpdated","__exports__","_withScopeId","n","_pushScopeId","_popScopeId","class","componentError","_toDisplayString","renderData","_renderSlot","$slots","disabled","defineComponent","name","onRenderEvent","event","renderEvent","detail","events","addEventListener","RENDER_EVENT","onUnmounted","removeEventListener","onErrorCaptured","err","String","components","PdfViewer","WithStreamlitConnection","createApp","App","mount","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","call","m","deferred","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","Object","keys","every","splice","r","d","definition","o","defineProperty","enumerable","get","g","globalThis","this","Function","e","prop","prototype","hasOwnProperty","installedChunks","chunkId","webpackJsonpCallback","parentChunkLoadingFunction","data","moreModules","runtime","some","chunkLoadingGlobal","self","forEach","bind","__webpack_exports__"],"sourceRoot":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: streamlit-pdf-viewer
|
|
3
|
-
Version: 0.0.18.
|
|
3
|
+
Version: 0.0.18.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
|
|
@@ -48,17 +48,19 @@ pdf_viewer("str, path or bytes")
|
|
|
48
48
|
|
|
49
49
|
In the following table the list of parameters that can be provided to the `pdf_viewer` function:
|
|
50
50
|
|
|
51
|
-
| name | description
|
|
52
|
-
|
|
53
|
-
| input | The source of the PDF file. Accepts a file path, URL, or binary data.
|
|
54
|
-
| width | Width of the PDF viewer in pixels. It defaults to 700 pixels.
|
|
55
|
-
| height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content.
|
|
56
|
-
| annotations | A list of annotations to be overlaid on the PDF. Format is described here.
|
|
57
|
-
| pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels.
|
|
58
|
-
| annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel.
|
|
59
|
-
| 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
|
|
60
|
-
| pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered.
|
|
61
|
-
| 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.
|
|
51
|
+
| name | description |
|
|
52
|
+
|-------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
53
|
+
| input | The source of the PDF file. Accepts a file path, URL, or binary data. |
|
|
54
|
+
| width | Width of the PDF viewer in pixels. It defaults to 700 pixels. |
|
|
55
|
+
| height | Height of the PDF viewer in pixels. If not provided, the viewer shows the whole content. |
|
|
56
|
+
| annotations | A list of annotations to be overlaid on the PDF. Format is described here. |
|
|
57
|
+
| pages_vertical_spacing | The vertical space (in pixels) between each page of the PDF. Defaults to 2 pixels. |
|
|
58
|
+
| annotation_outline_size | Size of the outline around each annotation in pixels. Defaults to 1 pixel. |
|
|
59
|
+
| 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: |
|
|
60
|
+
| pages_to_render | Filter the rendering to a specific set of pages. By default, all pages are rendered. |
|
|
61
|
+
| 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.
|
|
62
|
+
| scroll_to_page | Scroll to a specific page when the component is rendered. Default is None. Require ints and ignores the parameters below zero. |
|
|
63
|
+
| 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` |
|
|
62
64
|
|
|
63
65
|
|
|
64
66
|
### Annotation format
|
|
@@ -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.
|
|
25
|
-
streamlit_pdf_viewer/frontend/dist/js/app.
|
|
24
|
+
streamlit_pdf_viewer/frontend/dist/js/app.c29bbbdb.js
|
|
25
|
+
streamlit_pdf_viewer/frontend/dist/js/app.c29bbbdb.js.map
|
|
26
26
|
streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a06c44e8.js
|
|
27
27
|
streamlit_pdf_viewer/frontend/dist/js/chunk-vendors.a06c44e8.js.map
|
|
28
28
|
tests/__init__.py
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e={9282:(e,t,a)=>{var n=a(3751),r=a(641);const i={id:"app"};function o(e,t,a,n,o,s){const l=(0,r.g2)("PdfViewer"),d=(0,r.g2)("WithStreamlitConnection");return(0,r.uX)(),(0,r.CE)("div",i,[(0,r.bF)(d,null,{default:(0,r.k6)((({args:e})=>[(0,r.bF)(l,{args:e},null,8,["args"])])),_:1})])}var s=a(33);const l={key:0},d={key:0,id:"pdfAnnotations"},p=["id"],g={key:1},c=["src","width","height"],u={key:2},h=["src","width","height"],v={key:3};function w(e,t,a,n,i,o){return(0,r.uX)(),(0,r.CE)("div",{id:"pdfContainer",style:(0,s.Tr)(n.pdfContainerStyle)},["unwrap"===a.args.rendering?((0,r.uX)(),(0,r.CE)("div",l,[(0,r.Lk)("div",{id:"pdfViewer",style:(0,s.Tr)(n.pdfViewerStyle)},[a.args.annotations?((0,r.uX)(),(0,r.CE)("div",d,[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(n.filteredAnnotations,((e,t)=>((0,r.uX)(),(0,r.CE)("div",{key:t,style:(0,s.Tr)(n.getPageStyle)},[(0,r.Lk)("div",{style:(0,s.Tr)(n.getAnnotationStyle(e,t)),id:`annotation-${t}`},null,12,p)],4)))),128))])):(0,r.Q3)("",!0)],4)])):"legacy_embed"===a.args.rendering?((0,r.uX)(),(0,r.CE)("div",g,[(0,r.Lk)("embed",{src:`data:application/pdf;base64,${a.args.binary}`,width:`${a.args.width}`,height:`${a.args.height}`,type:"application/pdf"},null,8,c)])):"legacy_iframe"===a.args.rendering?((0,r.uX)(),(0,r.CE)("div",u,[(0,r.Lk)("embed",{src:`data:application/pdf;base64,${a.args.binary}`,width:`${a.args.width}`,height:`${a.args.height}`,type:"application/pdf"},null,8,h)])):((0,r.uX)(),(0,r.CE)("div",v," Error rendering option. "))],4)}a(4114),a(7642),a(8004),a(3853),a(5876),a(2475),a(5024),a(1698);var f=a(953),m=(a(7566),a(4883)),y=a(7445);const _="pdfjs-dist/cmaps/",E=!0,b=!0,C={props:["args"],setup(e){const t=(0,f.KR)(0),a=(0,f.KR)(0),n=(0,f.KR)([]),i=(0,f.KR)([]),o=(0,f.KR)([]),s=(0,f.KR)([]),l=0===e.args.pages_to_render.length,d=(0,r.EW)((()=>l?e.args.annotations:e.args.annotations.filter((t=>e.args.pages_to_render.includes(Number(t.page)))))),p=!0===e.args.render_text,g=(0,r.EW)((()=>({width:e.args.width?`${e.args.width}px`:`${a.value}px`,height:e.args.height?`${e.args.height}px`:"auto",overflow:"auto"}))),c={position:"relative"},u={position:"relative"},h=t=>{let a=0;if(l)for(let r=0;r<t-1;r++)a+=i.value[r]*n.value[r]+e.args.pages_vertical_spacing;else for(let r=0;r<i.value.length;r++)e.args.pages_to_render.includes(r+1)&&r<t-1&&(a+=i.value[r]*n.value[r]+e.args.pages_vertical_spacing);return a},v=(t,a)=>{const r=n.value[t.page-1],i={position:"absolute",left:t.x*r+"px",top:`${h(t.page)+t.y*r}px`,width:t.width*r+"px",height:t.height*r+"px",outline:e.args.annotation_outline_size*r+"px solid",outlineColor:t.color,cursor:"pointer","z-index":10};return a&&s.value.push(`annotation-${a}`),i},w=e=>{const t=e?.getElementsByTagName("canvas");for(let a=t.length-1;a>=0;a--)e?.removeChild(t.item(a))},C=(t,a,n,r,i=1)=>{const o=t.getViewport({scale:a,rotation:n}),s=(window.devicePixelRatio||1)*i,l=document.createElement("canvas");return l.id=`canvas_page_${r}`,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},k=async(e,t,a)=>{const n={canvasContext:t.getContext("2d"),viewport:a},r=e.render(n);if(await r.promise,p){const n=await e.getTextContent(),r=document.createElement("div");r.className="textLayer";const i=new m.D6({textContentSource:n,container:r,viewport:a,textDivs:[]});await i.render();const o=document.createElement("div");o.className="page";const s=document.createElement("div");s.className="canvasWrapper",s.appendChild(t),o.style="position: relative;";const l=document.getElementById("pdfViewer");o.appendChild(s),o.appendChild(r),l.appendChild(o)}else{const e=document.createElement("div");e.className="page";const a=document.createElement("div");a.className="canvasWrapper",a.appendChild(t),e.style="position: relative;",e.appendChild(a),pdfViewer.appendChild(e)}},x=async(r,s,l=null)=>{if(0===l.length){l=[];for(let e=0;e<r.numPages;e++)l.push(e+1)}let d=1;e.args.resolution_boost&&(d=e.args.resolution_boost);for(let p=1;p<=r.numPages;p++){const g=await r.getPage(p),c=g.rotate,u=g.getViewport({scale:1,rotation:c});if(e.args.height>0){const t=u.width/u.height,n=t*e.args.height;(0===a.value||n<a.value)&&(a.value=n)}const h=a.value/u.width;if(n.value.push(h),i.value.push(u.height),l.includes(p)){const e=C(g,h,c,p,d);s.style.setProperty("--scale-factor",h);const a=g.getViewport({scale:n.value[g._pageIndex],rotation:g.rotate,intent:"print"}),r=(window.devicePixelRatio||1)*d;t.value+=e.height/r,await k(g,e,a),void 0!==e.id&&o.value.push(e.id)}}l.length>0&&(t.value-=e.args.pages_vertical_spacing)},$=e=>{window.alert(e.message),console.error(e)},R=async t=>{try{const a=await(0,m.YE)({url:t,cMapUrl:_,cMapPacked:E,enableXfa:b}),n=document.getElementById("pdfViewer");w(n);const r=await a.promise;await x(r,n,e.args.pages_to_render)}catch(a){$(a)}},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.getElementById("annotation-"+(e.args.scroll_to_annotation-1));t&&t.scrollIntoView({behavior:"smooth",block:"center"})}},S=()=>{const e=new Set,t=new Set;let a;for(a=0;a<s.value.length;a++)t.add(s.value[a]);for(a=0;a<o.value.length;a++)e.add(o.value[a]);y.wk.setComponentValue({pages:Array.from(e),annotations:Array.from(t)})},P=()=>{y.wk.setFrameHeight(e.args.height||t.value)},N=()=>{null===e.args.width||void 0===e.args.width?a.value=window.innerWidth:Number.isInteger(e.args.width)&&(a.value=e.args.width,window.innerWidth>0&&window.innerWidth<a.value&&(a.value=window.innerWidth))};return(0,r.sV)((()=>{const t=`data:application/pdf;base64,${e.args.binary}`;N(),"unwrap"===e.args.rendering?R(t).then(P).then(S).then(y.wk.setComponentReady):(P(),y.wk.setComponentReady())})),(0,r.$u)((()=>{P(),"unwrap"===e.args.rendering&&V()})),{filteredAnnotations:d,getAnnotationStyle:v,pdfContainerStyle:g,pdfViewerStyle:c,getPageStyle:u}}};var k=a(6262);const x=(0,k.A)(C,[["render",w]]),$=x,R=e=>((0,r.Qi)("data-v-bef81972"),e=e(),(0,r.jt)(),e),V={key:0},S=R((()=>(0,r.Lk)("h1",{class:"err__title"},"Component Error",-1))),P={class:"err__msg"};function N(e,t,a,n,i,o){return(0,r.uX)(),(0,r.CE)("div",null,[""!=e.componentError?((0,r.uX)(),(0,r.CE)("div",V,[S,(0,r.Lk)("div",P,"Message: "+(0,s.v_)(e.componentError),1)])):null!=e.renderData?(0,r.RG)(e.$slots,"default",{key:1,args:e.renderData.args,disabled:e.renderData.disabled},void 0,!0):(0,r.Q3)("",!0)])}const X=(0,r.pM)({name:"WithStreamlitConnection",setup(){const e=(0,f.KR)(void 0),t=(0,f.KR)(""),a=a=>{const n=a;e.value=n.detail,t.value=""};return(0,r.sV)((()=>{y.wk.events.addEventListener(y.wk.RENDER_EVENT,a),y.wk.setComponentReady()})),(0,r.$u)((()=>{""!=t.value&&y.wk.setFrameHeight()})),(0,r.hi)((()=>{y.wk.events.removeEventListener(y.wk.RENDER_EVENT,a)})),(0,r.qG)((e=>{t.value=String(e)})),{renderData:e,componentError:t}}}),A=(0,k.A)(X,[["render",N],["__scopeId","data-v-bef81972"]]),O=A,W=(0,r.pM)({name:"App",components:{PdfViewer:$,WithStreamlitConnection:O}}),I=(0,k.A)(W,[["render",o]]),T=I;(0,n.Ef)(T).mount("#app")}},t={};function a(n){var r=t[n];if(void 0!==r)return r.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,a),i.exports}a.m=e,(()=>{var e=[];a.O=(t,n,r,i)=>{if(!n){var o=1/0;for(p=0;p<e.length;p++){for(var[n,r,i]=e[p],s=!0,l=0;l<n.length;l++)(!1&i||o>=i)&&Object.keys(a.O).every((e=>a.O[e](n[l])))?n.splice(l--,1):(s=!1,i<o&&(o=i));if(s){e.splice(p--,1);var d=r();void 0!==d&&(t=d)}}return t}i=i||0;for(var p=e.length;p>0&&e[p-1][2]>i;p--)e[p]=e[p-1];e[p]=[n,r,i]}})(),(()=>{a.d=(e,t)=>{for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}})(),(()=>{a.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()})(),(()=>{a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{var e={524:0};a.O.j=t=>0===e[t];var t=(t,n)=>{var r,i,[o,s,l]=n,d=0;if(o.some((t=>0!==e[t]))){for(r in s)a.o(s,r)&&(a.m[r]=s[r]);if(l)var p=l(a)}for(t&&t(n);d<o.length;d++)i=o[d],a.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return a.O(p)},n=self["webpackChunkstreamlit_pdf_viewer"]=self["webpackChunkstreamlit_pdf_viewer"]||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var n=a.O(void 0,[504],(()=>a(9282)));n=a.O(n)})();
|
|
2
|
-
//# sourceMappingURL=app.a7be2fe8.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_embed_height.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_embed_no_args.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_embed_width.py
RENAMED
|
File without changes
|
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_iframe_height.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_iframe_no_args.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_iframe_width.py
RENAMED
|
File without changes
|
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_invalid_params.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_rendering_text.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_resolution_boost.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_unwrap_height.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_unwrap_no_args.py
RENAMED
|
File without changes
|
{streamlit_pdf_viewer-0.0.18.dev0 → streamlit_pdf_viewer-0.0.18.dev1}/tests/test_unwrap_width.py
RENAMED
|
File without changes
|
|
File without changes
|