![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
react-pdfjs-multi
Advanced tools
React wrapper for pdfjs with multiple file support.
This library uses pdf.js.
For a preview of the current development visit github pages.
What does in development mean:
- MINOR versions represent breaking changes
- PATCH versions represent fixes and features
- There are no deprecation warnings between releases
yarn add react-pdfjs-multi
or
npm i react-pdfjs-multi
Example Usage:
import React, { PureComponent } from 'react';
import { PdfMultiViewer } from 'react-pdfjs-multi';
import 'react-pdfjs-multi/dist/react-pdfjs-multi.css';
const pdfFiles = [
'pdfs/test-pdf-a.pdf',
{
title: 'Trace-based Just-in-Time Type Specialization for DynamicLanguages',
source: 'pdfs/compressed.tracemonkey-pldi-09.pdf',
},
'pdfs/test-pdf-b.pdf',
'pdfs/test-pdf-c.pdf',
];
class MultiViewerExample extends PureComponent {
render() {
return <PdfMultiViewer pdfs={pdfFiles} />;
}
}
export default MultiViewerExample;
The MultiViewer allows you to pass an array of source strings or an object definition and it then loads all PDF's async and shows the renderer as soon as the first PDF is loaded.
Props:
Name | Required | Default | Type | Description |
---|---|---|---|---|
pdfs | true | {array} | An array of strings or objects | |
autoZoom | true | {boolean} | enables/disables autoZoom on component mount and window resize | |
controls | true | {boolean} | enables/disables controls to e.g. change renderer zoom | |
i18nData | {}* | {I18nData} | An object of translated strings, default language is en | |
startIndex | 0 | {number} | first pdf to load using array index |
To be able to use different i18n libraries eg. i18next or react-intl you can pass an i18n object with translated strings to the component.
*defaults:
{
// Viewer
pages: 'Pages',
// Renderer
zoom: 'Automatic zoom',
originalSize: 'Original size',
rotateLeft: 'Rotate left',
rotateRight: 'Rotate right',
scaleUp: 'Scale up',
scaleDown: 'Scale down',
download: 'Download',
}
If you like to implement your own custom multi renderer logic you can use the PdfRenderer component. For an implementation example see Example.
Props:
Name | Required | Default | Type | Description |
---|---|---|---|---|
pdfDoc | true | {PDFDocumentProxy} | A proxy of the pdf document to display | |
autoZoom | true | {boolean} | enables/disables autoZoom on component mount and window resize | |
controls | true | {boolean} | enables/disables controls to e.g. change renderer zoom | |
downloadBtn | true | {boolean} | enables/disables download button | |
i18nData | {}* | {I18nDataRenderer} | An object of translated strings, default language is en | |
zoom | null | {number} | Initial Zoom | |
rotation | null | {number} | Initial Rotation | |
scrollTop | null | {number} | Initial ScrollTop | |
scrollLeft | null | {number} | Initial ScrollLeft | |
activeIndex | null | {number} | Is required whenn the pdfChangeHook is used | |
pdfChangeHook | null | {func} | Callback function which gets a position object |
FAQs
React wrapper for pdfjs with multiple file support
The npm package react-pdfjs-multi receives a total of 7 weekly downloads. As such, react-pdfjs-multi popularity was classified as not popular.
We found that react-pdfjs-multi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.