Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
react-native-pdf-thumbnail
Advanced tools
A react native module for generating thumbnail for PDF files.
A wrapper for:
No other JavaScript or native dependencies.
Note: This module does not work in Expo.
npm install react-native-pdf-thumbnail
import PdfThumbnail from "react-native-pdf-thumbnail";
// For iOS, the filePath can be a file URL.
// For Android, the filePath can be either a content URI, a file URI or an absolute path.
const filePath = 'file:///mnt/sdcard/myDocument.pdf';
const page = 0;
// The thumbnail image is stored in caches directory, file uri is returned.
// Image dimensions are also available to help you display it correctly.
const { uri, width, height } = await PdfThumbnail.generate(filePath, page);
// Generate thumbnails for all pages, returning an array of the object above.
const results = await PdfThumbnail.generateAllPages(filePath);
// Default compression quality is 80, you can optionally specify a quality between 0 and 100.
const { uri, width, height } = await PdfThumbnail.generate(filePath, page, 95);
const results = await PdfThumbnail.generateAllPages(filePath, 90);
The example app contains a document picker, it generates and displays a thumbnail for the selected PDF file.
To run it:
yarn
yarn example ios
yarn example android
iOS | Android |
---|---|
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
FAQs
Generate thumbnail for PDF files
The npm package react-native-pdf-thumbnail receives a total of 3,323 weekly downloads. As such, react-native-pdf-thumbnail popularity was classified as popular.
We found that react-native-pdf-thumbnail 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.