react native pdf creater html to pdf

Solutions on MaxInterview for react native pdf creater html to pdf by the best coders in the world

showing results for - "react native pdf creater html to pdf"
Owen
01 Mar 2016
1import React, { Component } from 'react';
2
3import {
4  Text,
5  TouchableHighlight,
6  View,
7} from 'react-native';
8
9import RNHTMLtoPDF from 'react-native-html-to-pdf';
10
11export default class Example extends Component {
12  async createPDF() {
13    let options = {
14      html: '<h1>PDF TEST</h1>',
15      fileName: 'test',
16      directory: 'Documents',
17    };
18
19    let file = await RNHTMLtoPDF.convert(options)
20    // console.log(file.filePath);
21    alert(file.filePath);
22  }
23
24  render() {
25    return(
26      <View>
27        <TouchableHighlight onPress={this.createPDF}>
28          <Text>Create PDF</Text>
29        </TouchableHighlight>
30      </View>
31    )
32  }
33}