Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@llamaindex/pdf-viewer

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@llamaindex/pdf-viewer - npm Package Compare versions

Comparing version 1.1.1 to 1.1.3

2

dist/cjs/view/VirtualizedPdf.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc