Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import {
- Text,
- TouchableHighlight,
- View,
- PermissionsAndroid,
- Button
- } from 'react-native';
- import RNHTMLtoPDF from 'react-native-html-to-pdf';
- export default class App extends Component {
- state = {
- filePath: ''
- };
- constructor(props) {
- super(props);
- }
- async createPDF() {
- let options = {
- html: '<h1>PDF TEST</h1>',
- fileName: 'test',
- directory: 'docs',
- };
- let file = await RNHTMLtoPDF.convert(options)
- // console.log(file.filePath);
- alert(file.filePath);
- }
- render() {
- return (
- <View>
- <Button onPress={this.createPDF} title="Click me2" color="#841584" />
- </View>
- )
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement