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