Gathering detailed insights and metrics for react-native-html-to-pdf
Gathering detailed insights and metrics for react-native-html-to-pdf
Gathering detailed insights and metrics for react-native-html-to-pdf
Gathering detailed insights and metrics for react-native-html-to-pdf
@types/react-native-html-to-pdf
TypeScript definitions for react-native-html-to-pdf
react-native-pdf
A react native PDF view component, support ios and android platform
react-native-html-to-pdf-lite
Convert html strings to PDF documents using React Native
@config-plugins/react-native-pdf
Config plugin to auto configure react-native-pdf on prebuild
npm install react-native-html-to-pdf
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
437 Stars
87 Commits
270 Forks
11 Watching
3 Branches
36 Contributors
Updated on 18 Nov 2024
Minified
Minified + Gzipped
Java (44.51%)
Objective-C (37.2%)
JavaScript (11.28%)
Starlark (5.23%)
Ruby (1.78%)
Cumulative downloads
Total Downloads
Last day
-1.7%
13,184
Compared to previous day
Last week
29.1%
78,193
Compared to previous week
Last month
-1%
275,683
Compared to previous month
Last year
110.6%
3,251,786
Compared to previous year
No dependencies detected.
Convert html strings to PDF documents using React Native
npm install react-native-html-to-pdf --save
react-native link
libRNHTMLtoPDF.a
to Build Phases -> Link Binary With Libraries
(Screenshot).android/settings.gradle
to included1include ':react-native-html-to-pdf' 2project(':react-native-html-to-pdf').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-html-to-pdf/android')
android/app/build.gradle
file to include1dependencies { 2 .... 3 compile project(':react-native-html-to-pdf') 4 5}
MainApplication.java
to include1// import the package 2import com.christopherdro.htmltopdf.RNHTMLtoPDFPackage; 3 4// include package 5new MainReactPackage(), 6new RNHTMLtoPDFPackage()
WRITE_EXTERNAL_STORAGE
permission to AndroidManifest.xml
1<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Also starting from Android M, users need to be prompted for permission dynamically. Follow this link for more details on how to do that.
1 2import React, { Component } from 'react'; 3 4import { 5 Text, 6 TouchableHighlight, 7 View, 8} from 'react-native'; 9 10import RNHTMLtoPDF from 'react-native-html-to-pdf'; 11 12export default class Example extends Component { 13 async createPDF() { 14 let options = { 15 html: '<h1>PDF TEST</h1>', 16 fileName: 'test', 17 directory: 'Documents', 18 }; 19 20 let file = await RNHTMLtoPDF.convert(options) 21 // console.log(file.filePath); 22 alert(file.filePath); 23 } 24 25 render() { 26 return( 27 <View> 28 <TouchableHighlight onPress={this.createPDF}> 29 <Text>Create PDF</Text> 30 </TouchableHighlight> 31 </View> 32 ) 33 } 34}
Param | Type | Default | Note |
---|---|---|---|
html | string | HTML string to be converted | |
fileName | string | Random | Custom Filename excluding .pdf extension |
base64 | boolean | false | return base64 string of pdf file (not recommended) |
directory | string | default cache directory | Directory where the file will be created (Documents folder in example above). Please note, on iOS Documents is the only custom value that is accepted. |
height | number | 792 | Set document height (points) |
width | number | 612 | Set document width (points) |
Param | Type | Default | Note |
---|---|---|---|
paddingLeft | number | 10 | Outer left padding (points) |
paddingRight | number | 10 | Outer right padding (points) |
paddingTop | number | 10 | Outer top padding (points) |
paddingBottom | number | 10 | Outer bottom padding (points) |
padding | number | 10 | Outer padding for any side (points), overrides any padding listed before |
bgColor | string | #F6F5F0 | Background color in Hexadecimal |
Param | Type | Default | Note |
---|---|---|---|
fonts | Array | Allow custom fonts ['/fonts/TimesNewRoman.ttf', '/fonts/Verdana.ttf'] |
No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 12/20 approved changesets -- score normalized to 6
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
69 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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