Gathering detailed insights and metrics for react-native-pdf-light
Gathering detailed insights and metrics for react-native-pdf-light
Gathering detailed insights and metrics for react-native-pdf-light
Gathering detailed insights and metrics for react-native-pdf-light
npm install react-native-pdf-light
Typescript
Module System
Node Version
NPM Version
TypeScript (40.19%)
Kotlin (25.43%)
Swift (17.73%)
Java (7.68%)
Objective-C (5.36%)
JavaScript (1.82%)
Ruby (1.66%)
C (0.13%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
80 Stars
115 Commits
11 Forks
1 Watchers
3 Branches
2 Contributors
Updated on Jun 05, 2025
Latest Version
2.4.2
Package Id
react-native-pdf-light@2.4.2
Unpacked Size
244.48 kB
Size
50.84 kB
File Count
60
NPM Version
10.8.2
Node Version
22.5.1
Published on
May 23, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
22
PDF viewer for React Native. Implemented with platform native render functions for smallest deploy size impact, and restricted feature set to simplify integration with larger systems.
Includes prefabricated full document viewer based on FlatList
and a single
page render component to use as a building block for your own fully custom
viewer.
Uses android.graphics.pdf.PdfRenderer
on Android and CGPDFDocument
on iOS.
Unlike many native components in the wild, react-native-pdf-light
provides
full implementation of React Native shadow nodes. This simplifies UI
development, since the component actually knows its own dimensions.
Version 2.x, adds render support for annotations conforming the PAS standard v1. If annotation support is not needed, use 1.x for slightly reduced size.
1npm install react-native-pdf-light
If iOS build fails with Undefined symbol: __swift_FORCE_LOAD_...
, add an
empty .swift
file to the xcode project.
1import { Pdf, PdfUtil } from 'react-native-pdf-light'; 2 3PdfUtil.getPageCount(source).then(console.log); 4 5<Pdf source={source} />
If creating your own custom viewer to manage pages:
1import { PdfView } from 'react-native-pdf-light'; 2 3<PdfView page={page} source={source} />
For zoom support, install react-native-gesture-handler
and use deep import.
Note that react-native-gesture-handler
is only required to use zoom
features; the other display options do not have any dependencies.
1import { ZoomPdfView } from 'react-native-pdf-light/Zoom'; 2 3<ZoomPdfView page={page} source={source} />
<Pdf ... />
Display a pdf.Props:
annotation: string
annotationStr: string
onError: (error: Error) => void
onLoadComplete: (numberOfPages: number) => void
onMeasurePages: (measurements: { itemHeight: number, offset: number }[]) => void
shrinkToFit: 'never' | 'portrait' | 'landscape' | 'always'
source: string
The following props are forwarded to the underlying
FlatList
component:
initialScrollIndex
ListEmptyComponent
onMomentumScrollBegin
onMomentumScrollEnd
onScroll
onScrollBeginDrag
onScrollEndDrag
refreshControl
scrollEventThrottle
Methods:
scrollToIndex(index: number): void
scrollToOffset(offset: number): void
<PdfView ... />
Single page of a pdf.Props:
annotation: string
annotationStr: string
page: number
resizeMode: 'contain' | 'fitWidth'
source: string
style: ViewStyle
<ZoomPdfView ... />
Pinch zoomable single page of a pdf.Zoom interactions compatible with react-native-pager-view
in horizontal
display mode.
Props:
PdfView
onZoomIn: () => void
onZoomReset: () => void
maximumZoom: number
refreshControl: <RefreshControl />
RefreshControl
component, used to provide pull-to-refresh functionality for the internal ScrollView.PdfUtil
Utility functions.PdfUtil.getPageCount(source: string): Promise<number>
PdfUtil.getPageSizes(source: string): Promise<{ height: number; width: number }[]>
On Android API level < 26 when directly rendering pages with PdfView
at a
non-default aspect ratio (e.g. setting both width and height of the view such
that the view's aspect ratio does not match the pdf page's aspect ratio) if
a page in the pdf is cropped or rotated, the page
may render in the wrong position. This is due to a bug in the native
android.graphics.pdf.PdfRenderer
. (If you are aware of a fix,
pull requests welcome.)
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
2 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 1/26 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
20 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More