React native PDF Creator
install package react-native-html-to-pdf.
import React, { Component } from 'react';
import {
Text,
TouchableHighlight,
View,
} from 'react-native';
import RNHTMLtoPDF from 'react-native-html-to-pdf';
class Example extends Component {
async createPDF() {
let options = {
html: '<h1>Example PDF</h1>',
fileName: 'example',
directory: 'Documents',
};
let file = await RNHTMLtoPDF.convert(options)
console.log(file.filePath);
}
render() {
return(
<View>
<TouchableHighlight onPress={this.createPDF}>
<Text>Create PDF</Text>
</TouchableHighlight>
</View>
)
}
}
export default Example;