Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import React, { Component } from 'react';
  2.  
  3. import {
  4. Text,
  5. TouchableHighlight,
  6. View,
  7. PermissionsAndroid,
  8. Button
  9. } from 'react-native';
  10.  
  11. import RNHTMLtoPDF from 'react-native-html-to-pdf';
  12.  
  13. export default class App extends Component {
  14. state = {
  15. filePath: ''
  16. };
  17. constructor(props) {
  18. super(props);
  19. }
  20.  
  21. async createPDF() {
  22. let options = {
  23. html: '<h1>PDF TEST</h1>',
  24. fileName: 'test',
  25. directory: 'docs',
  26. };
  27.  
  28. let file = await RNHTMLtoPDF.convert(options)
  29. // console.log(file.filePath);
  30. alert(file.filePath);
  31. }
  32.  
  33. render() {
  34. return (
  35. <View>
  36. <Button onPress={this.createPDF} title="Click me2" color="#841584" />
  37. </View>
  38. )
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement