@llamaindex/pdf-viewer
Advanced tools
Comparing version 1.1.1 to 1.1.3
@@ -53,3 +53,3 @@ "use strict"; | ||
pdfjsOptions.workerSrc = | ||
'//unpkg.com/pdfjs-dist@' + String(pdfjsVersion) + '/legacy/build/pdf.worker.min.js'; | ||
'//unpkg.com/pdfjs-dist@' + String(pdfjsVersion) + '/legacy/build/pdf.worker.min.mjs'; | ||
const { HORIZONTAL_GUTTER_SIZE_PX, OBSERVER_THRESHOLD_PERCENTAGE, PAGE_HEIGHT, PDF_HEADER_SIZE_PX, PDF_SIDEBAR_SIZE_PX, PDF_WIDTH_PERCENTAGE, VERTICAL_GUTTER_SIZE_PX, } = constants_js_1.PDF_DISPLAY_DEFAULTS; | ||
@@ -56,0 +56,0 @@ const PageRenderer = ({ file, pageNumber, style, scale, listWidth, setPageInView, }) => { |
@@ -25,3 +25,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
pdfjsOptions.workerSrc = | ||
'//unpkg.com/pdfjs-dist@' + String(pdfjsVersion) + '/legacy/build/pdf.worker.min.js'; | ||
'//unpkg.com/pdfjs-dist@' + String(pdfjsVersion) + '/legacy/build/pdf.worker.min.mjs'; | ||
const { HORIZONTAL_GUTTER_SIZE_PX, OBSERVER_THRESHOLD_PERCENTAGE, PAGE_HEIGHT, PDF_HEADER_SIZE_PX, PDF_SIDEBAR_SIZE_PX, PDF_WIDTH_PERCENTAGE, VERTICAL_GUTTER_SIZE_PX, } = PDF_DISPLAY_DEFAULTS; | ||
@@ -28,0 +28,0 @@ const PageRenderer = ({ file, pageNumber, style, scale, listWidth, setPageInView, }) => { |
{ | ||
"name": "@llamaindex/pdf-viewer", | ||
"version": "1.1.1", | ||
"version": "1.1.3", | ||
"description": "React PDF viewer for LLM applications", | ||
@@ -43,3 +43,3 @@ "type": "module", | ||
"react-intersection-observer": "9.5.1", | ||
"react-pdf": "6.2.2", | ||
"react-pdf": "^9.1.0", | ||
"react-window": "1.8.9" | ||
@@ -46,0 +46,0 @@ }, |
@@ -54,2 +54,38 @@ # PDF viewer for RAG applications | ||
## Next.js | ||
NextJs applications may need to update their configuration to be compatible with react-pdf v9 and pdfjs v4 | ||
If you have issues related to canvas, you can add the following to your `next.config.js`: | ||
```diff | ||
module.exports = { | ||
+ webpack: (config) => { | ||
+ config.resolve.alias.canvas = false; | ||
+ return config; | ||
+ }, | ||
} | ||
``` | ||
Another common issue is: `TypeError: Promise.withResolvers is not a function` | ||
To fix this issue, you need to use dynamic imports for the PDF component (to indicate to NextJs to use it for client-side rendering only). | ||
```diff | ||
- import { PDFViewer, PdfFocusProvider } from "@llamaindex/pdf-viewer"; | ||
+ import dynamic from "next/dynamic"; | ||
+ // Dynamic imports for client-side rendering only | ||
+ const PDFViewer = dynamic( | ||
+ () => import("@llamaindex/pdf-viewer").then((module) => module.PDFViewer), | ||
+ { ssr: false }, | ||
+ ); | ||
+ const PdfFocusProvider = dynamic( | ||
+ () => | ||
+ import("@llamaindex/pdf-viewer").then((module) => module.PdfFocusProvider), | ||
+ { ssr: false }, | ||
+ ); | ||
``` | ||
## 🙏 Thanks | ||
@@ -56,0 +92,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110324
100
+ Added@mapbox/node-pre-gyp@1.0.11(transitive)
+ Addedabbrev@1.1.1(transitive)
+ Addedagent-base@6.0.2(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedaproba@2.0.0(transitive)
+ Addedare-we-there-yet@2.0.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcanvas@2.11.2(transitive)
+ Addedchownr@2.0.0(transitive)
+ Addedcolor-support@1.1.3(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconsole-control-strings@1.1.0(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddecompress-response@4.2.1(transitive)
+ Addeddelegates@1.0.0(transitive)
+ Addeddequal@2.0.3(transitive)
+ Addeddetect-libc@2.0.3(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedfs-minipass@2.1.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedgauge@3.0.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhas-unicode@2.0.1(transitive)
+ Addedhttps-proxy-agent@5.0.1(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedmake-dir@3.1.0(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminipass@3.3.65.0.0(transitive)
+ Addedminizlib@2.1.2(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addedms@2.1.3(transitive)
+ Addednan@2.22.0(transitive)
+ Addednode-fetch@2.7.0(transitive)
+ Addednopt@5.0.0(transitive)
+ Addednpmlog@5.0.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath2d@0.2.2(transitive)
+ Addedpdfjs-dist@4.4.168(transitive)
+ Addedreact-pdf@9.1.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@6.3.17.6.3(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@3.1.1(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedtar@6.2.1(transitive)
+ Addedtr46@0.0.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwarning@4.0.3(transitive)
+ Addedwebidl-conversions@3.0.1(transitive)
+ Addedwhatwg-url@5.0.0(transitive)
+ Addedwide-align@1.1.5(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedyallist@4.0.0(transitive)
- Removedclsx@1.2.1(transitive)
- Removeddommatrix@1.0.3(transitive)
- Removedpdfjs-dist@2.16.105(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedreact-pdf@6.2.2(transitive)
- Removedtiny-warning@1.0.3(transitive)
- Removedweb-streams-polyfill@3.3.3(transitive)
Updatedreact-pdf@^9.1.0