invenio-previewer 3.4.1__py2.py3-none-any.whl → 3.5.0__py2.py3-none-any.whl

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.
@@ -352,6 +352,6 @@ Now define the priority for all previewers by adding the newly created
352
352
  from .ext import InvenioPreviewer
353
353
  from .proxies import current_previewer
354
354
 
355
- __version__ = "3.4.1"
355
+ __version__ = "3.5.0"
356
356
 
357
357
  __all__ = ("__version__", "current_previewer", "InvenioPreviewer")
@@ -38,6 +38,21 @@ PREVIEWER_ZIP_MAX_FILES = 1000
38
38
  PREVIEWER_PDF_JS_ENABLE_SCRIPTING = False
39
39
  """Enable JavaScript execution in PDF files (disabled by default for security)."""
40
40
 
41
+ PREVIEWER_PDF_JS_DOCUMENT_INIT_PARAMS = None
42
+ """Additional DocumentInitParameters passed to pdfjsLib.getDocument().
43
+
44
+ See https://mozilla.github.io/pdf.js/api/draft/module-pdfjsLib.html for the full
45
+ list of available options.
46
+
47
+ Example (disable range requests, streaming, and auto-fetching)::
48
+
49
+ PREVIEWER_PDF_JS_DOCUMENT_INIT_PARAMS = {
50
+ "disableStream": True,
51
+ "disableRange": True,
52
+ "disableAutoFetch": True,
53
+ }
54
+ """
55
+
41
56
  PREVIEWER_PREFERENCE = [
42
57
  "csv_papaparsejs",
43
58
  "simple_image",
@@ -26,6 +26,9 @@ document.addEventListener("DOMContentLoaded", () => {
26
26
  const CMAP_URL = "/static/js/pdfjs/cmaps/";
27
27
  const CMAP_PACKED = true;
28
28
 
29
+ // Some PDFs with JPEG 2000 images need the external OpenJPEG Wasm module
30
+ const WASM_URL = "/static/js/pdfjs/wasm/";
31
+
29
32
  // Get the PDF file's URL
30
33
  const PDF_URL = document.getElementById("pdf-file-uri").value;
31
34
  const ENABLE_XFA = true;
@@ -35,6 +38,10 @@ document.addEventListener("DOMContentLoaded", () => {
35
38
  const ENABLE_SCRIPTING = enableScriptingElement ? enableScriptingElement.value === "true" : false;
36
39
  const SANDBOX_BUNDLE_SRC = "/static/js/pdfjs/build/pdf.sandbox.min.mjs";
37
40
 
41
+ // Get additional document init params from config (defaults to empty object)
42
+ const documentInitParamsElement = document.getElementById("pdf-document-init-params");
43
+ const DOCUMENT_INIT_PARAMS = documentInitParamsElement ? JSON.parse(documentInitParamsElement.value || '{}') : {};
44
+
38
45
  const container = document.getElementById("viewerContainer");
39
46
  const nextPageButton = document.getElementById("next");
40
47
  const prevPageButton = document.getElementById("previous");
@@ -144,7 +151,9 @@ document.addEventListener("DOMContentLoaded", () => {
144
151
  url: PDF_URL,
145
152
  cMapUrl: CMAP_URL,
146
153
  cMapPacked: CMAP_PACKED,
154
+ wasmUrl: WASM_URL,
147
155
  enableXfa: ENABLE_XFA,
156
+ ...DOCUMENT_INIT_PARAMS,
148
157
  });
149
158
  (async function () {
150
159
  const pdfDocument = await loadingTask.promise;
@@ -29,6 +29,7 @@
29
29
  {%- block page_body %}
30
30
  <input id="pdf-file-uri" type="hidden" value="{{ file.uri }}" />
31
31
  <input id="pdf-enable-scripting" type="hidden" value="{{ config.PREVIEWER_PDF_JS_ENABLE_SCRIPTING|default(false)|lower }}" />
32
+ <input id="pdf-document-init-params" type="hidden" value="{{ config.PREVIEWER_PDF_JS_DOCUMENT_INIT_PARAMS|default({})|tojson }}" />
32
33
 
33
34
  <div id="outerContainer">
34
35
  <div id="mainContainer">
@@ -66,6 +66,10 @@ previewer = WebpackThemeBundle(
66
66
  "from": "../node_modules/pdfjs-dist/cmaps",
67
67
  "to": "../../static/js/pdfjs/cmaps",
68
68
  },
69
+ {
70
+ "from": "../node_modules/pdfjs-dist/wasm",
71
+ "to": "../../static/js/pdfjs/wasm",
72
+ },
69
73
  {
70
74
  "from": "../node_modules/pdfjs-dist/web",
71
75
  "to": "../../static/js/pdfjs/web",
@@ -113,6 +117,10 @@ previewer = WebpackThemeBundle(
113
117
  "from": "../node_modules/pdfjs-dist/cmaps",
114
118
  "to": "../../static/js/pdfjs/cmaps",
115
119
  },
120
+ {
121
+ "from": "../node_modules/pdfjs-dist/wasm",
122
+ "to": "../../static/js/pdfjs/wasm",
123
+ },
116
124
  {
117
125
  "from": "../node_modules/pdfjs-dist/web",
118
126
  "to": "../../static/js/pdfjs/web",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invenio-previewer
3
- Version: 3.4.1
3
+ Version: 3.5.0
4
4
  Summary: Invenio module for previewing files.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-previewer
6
6
  Author: CERN
@@ -96,6 +96,17 @@ available at: https://github.com/webrecorder/replayweb.page
96
96
  Changes
97
97
  =======
98
98
 
99
+ Version v3.5.0 (released 2025-11-12)
100
+
101
+ - feat(pdfjs): allow passing parameters to document init
102
+ * Adds a new `PREVIEWER_PDF_JS_DOCUMENT_INIT_PARAMS` config to allow
103
+ passing init parameters to `pdfjsLib.getDocument()`.
104
+ - docs: add config section in API reference
105
+
106
+ Version v3.4.2 (released 2025-11-04)
107
+
108
+ - fix(pdfjs): specify Wasm URL parameter for OpenJPEG decoding
109
+
99
110
  Version v3.4.1 (released 2025-10-21)
100
111
 
101
112
  - i18n: pulled translations
@@ -103,6 +114,7 @@ Version v3.4.1 (released 2025-10-21)
103
114
  Version v3.4.0 (released 2025-10-08)
104
115
 
105
116
  - feat(warc): new Web Archive previewer
117
+ - feat(pdfjs): bump pdfjs-dist to v5.x
106
118
 
107
119
  Version v3.3.0 (released 2025-08-25)
108
120
 
@@ -1,11 +1,11 @@
1
- invenio_previewer/__init__.py,sha256=75gmu2A0AVSTUZSxHsF924T6KgywqdjhnihnI7Cmb8s,12292
1
+ invenio_previewer/__init__.py,sha256=LfePbqHmkb3MDjzDjK59K9ddMMK9ExKJKgnm2UCX31c,12292
2
2
  invenio_previewer/api.py,sha256=ntblD3P-nAlVmL6gTx4tJHJmoJp4tOFwoVz8gMh6T5U,1708
3
- invenio_previewer/config.py,sha256=rtOfHcLZtsC7Y7TWloHM1WsotrIoWns-Uy96sJ7ybEA,2183
3
+ invenio_previewer/config.py,sha256=7QCbs8zJhVGyaBFo0UPW-w9HX_nPxsEqdltv-eTQt1Q,2627
4
4
  invenio_previewer/ext.py,sha256=lWGOZXP78qv2PaA0lnrWkEGZ6C0kz9Mx1ioxcpnKfho,4559
5
5
  invenio_previewer/proxies.py,sha256=vzcZDzP4MlKJAXJu2u6Las0o4fxSJ2qOmtREszPkmxM,479
6
6
  invenio_previewer/utils.py,sha256=dj1ZAgRLs05Xiali7BHaNJR1oSm_98YbZVuH8gQ_tDw,1970
7
7
  invenio_previewer/views.py,sha256=iBgV0UKeOosVkU60CMSnAbN4cTmjTXUQClGl9HWGWJk,2483
8
- invenio_previewer/webpack.py,sha256=kUxg3cRG6Vjalt2E9dtKr3MAcFKnU4-8mVzWKJlwKpk,5260
8
+ invenio_previewer/webpack.py,sha256=NNlowng7-6--IzAWSRLCYRfVYOpI-00iiiehaHVuRFs,5572
9
9
  invenio_previewer/assets/bootstrap3/css/invenio_previewer/prismjs/simple.css,sha256=_8CrMr-DmI6-WBFyCZ1g4nMKp__PSVy_avNOyF8PCGs,383
10
10
  invenio_previewer/assets/bootstrap3/css/invenio_previewer/simple_image/simple_image.css,sha256=O3QoTQ2n_713PBTbpyGKlr6nHZ5CWF0F2OFA6bS6Gs4,270
11
11
  invenio_previewer/assets/bootstrap3/js/invenio_previewer/previewer_theme.js,sha256=cr1o_4KH4lVfA9G5H8bpG6p9V1dACxz9ICUPlWsMLFE,335
@@ -51,7 +51,7 @@ invenio_previewer/static/images/pdfjs/next.svg,sha256=s8cVHIiKmueVrJclJ-guEFe_76
51
51
  invenio_previewer/static/images/pdfjs/plus.svg,sha256=jHVi4RtaGnJAeMHeTZ6fsysRx568VzbFFvraL9PmCyY,1490
52
52
  invenio_previewer/static/images/pdfjs/previous.svg,sha256=zC_FFUD9qeGmieo3UwaekoU3L8aTgxp2WTHLOT3HvDE,577
53
53
  invenio_previewer/static/js/fullscreen.js,sha256=1FIvn_zJSgCkrzy8NZTQ3jNUrnaCUfzZOyaFCFzY_vc,1845
54
- invenio_previewer/static/js/open_pdf.js,sha256=Vp2IZdbx0G0XMoG1yAYfDPPNg8ijpZhBVJdTH71Q6-w,5397
54
+ invenio_previewer/static/js/open_pdf.js,sha256=etxTvTbPiNnG3gxL3TPc37jTNKdOVeYIHppkUwvhxcA,5858
55
55
  invenio_previewer/templates/invenio_previewer/abstract_previewer.html,sha256=oeiYsCclUn_uu_NXa42IifG63ilhOYxPXWXOa1J-C-A,563
56
56
  invenio_previewer/templates/invenio_previewer/base.html,sha256=SnDtG7ru1USS6ihU9By_VN-Lv1SW5Wu_Z1rAdUFGTL8,803
57
57
  invenio_previewer/templates/invenio_previewer/bottom.html,sha256=TcHhwCwyhMJKISw1FG7kzhJxw5qlyQdTfkvJncGhu7k,2190
@@ -61,7 +61,7 @@ invenio_previewer/templates/invenio_previewer/ipynb.html,sha256=UACHV9vaGYnnZ5gu
61
61
  invenio_previewer/templates/invenio_previewer/json_prismjs.html,sha256=RT54rrIgDUltgm6Ud0zz3QhgBU1ruZg4cKkABmVOe1Q,387
62
62
  invenio_previewer/templates/invenio_previewer/macros.html,sha256=_ES1RvdaXYhOnIUBVn-YFhbuW4KhRduZrSOpez6PR_0,2519
63
63
  invenio_previewer/templates/invenio_previewer/mistune.html,sha256=DPWzm079QlLhmw1l6mtvGsggznwYoton43oJBQItTs0,483
64
- invenio_previewer/templates/invenio_previewer/pdfjs.html,sha256=PSj_3bBzndV9qtkBn4dunQJnXUYMdPxA0qCMaWhdtBc,6976
64
+ invenio_previewer/templates/invenio_previewer/pdfjs.html,sha256=Hsg0hVDkddTUw8pK2M9uUPa5r8ICjyR6i8yn0t0MGVM,7108
65
65
  invenio_previewer/templates/invenio_previewer/simple_image.html,sha256=yCbmWrGgrZ--I8ZbKWSJvlNLzzEqV2ay4_Klzon-cBw,391
66
66
  invenio_previewer/templates/invenio_previewer/top.html,sha256=8Ry8B0BXv2hxLjPCp1XwJssL7M0r7ENwZTzMb29vC5Q,682
67
67
  invenio_previewer/templates/invenio_previewer/txt.html,sha256=yiStQx2nGoVvNpFWXW3SihjwyleL8ffu1HFTWIIBePE,511
@@ -146,10 +146,10 @@ invenio_previewer/translations/zh_CN/LC_MESSAGES/messages.mo,sha256=F75XtB6vrlNO
146
146
  invenio_previewer/translations/zh_CN/LC_MESSAGES/messages.po,sha256=YKEqdgACVuwj7DroAVz4b60ZeiDx3nLfB5RzXHpTF74,16227
147
147
  invenio_previewer/translations/zh_TW/LC_MESSAGES/messages.mo,sha256=uMZNBr5-xusB4mmh8075J9LAp0lYDvILQcMwxGlhATc,807
148
148
  invenio_previewer/translations/zh_TW/LC_MESSAGES/messages.po,sha256=S8o0foNsG4pLH8VwXu8Fq51ngLQIBkhpJ1Nfa3CEZbU,15485
149
- invenio_previewer-3.4.1.dist-info/licenses/AUTHORS.rst,sha256=wcFhv9iJlZPq0MkvNHDVBEn5iXZGsVfC32yjS2jW9CQ,486
150
- invenio_previewer-3.4.1.dist-info/licenses/LICENSE,sha256=p3bBZtg1gwhzibgFe4OuiiUStzewJS5TD6MC5Vu1uSM,1067
151
- invenio_previewer-3.4.1.dist-info/METADATA,sha256=W8LYPDhlnL1-7GN6ji0d9sI4gUv0cGIcIzj1VvWjgEo,9090
152
- invenio_previewer-3.4.1.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
153
- invenio_previewer-3.4.1.dist-info/entry_points.txt,sha256=gYe4eWC5Pul52jSjV_sdeIffYCm6KzwHhNkUsxrm7vc,916
154
- invenio_previewer-3.4.1.dist-info/top_level.txt,sha256=BwA4Jo3Wv0rLjDkEuCEIR2W-lz1EXRc7h9jzDwaMK3o,18
155
- invenio_previewer-3.4.1.dist-info/RECORD,,
149
+ invenio_previewer-3.5.0.dist-info/licenses/AUTHORS.rst,sha256=wcFhv9iJlZPq0MkvNHDVBEn5iXZGsVfC32yjS2jW9CQ,486
150
+ invenio_previewer-3.5.0.dist-info/licenses/LICENSE,sha256=p3bBZtg1gwhzibgFe4OuiiUStzewJS5TD6MC5Vu1uSM,1067
151
+ invenio_previewer-3.5.0.dist-info/METADATA,sha256=ghLnS-FBPU63Jt5Ac9fPm6eEco7zZUWoozPfKzb0spM,9503
152
+ invenio_previewer-3.5.0.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
153
+ invenio_previewer-3.5.0.dist-info/entry_points.txt,sha256=gYe4eWC5Pul52jSjV_sdeIffYCm6KzwHhNkUsxrm7vc,916
154
+ invenio_previewer-3.5.0.dist-info/top_level.txt,sha256=BwA4Jo3Wv0rLjDkEuCEIR2W-lz1EXRc7h9jzDwaMK3o,18
155
+ invenio_previewer-3.5.0.dist-info/RECORD,,