Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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>
    )
  }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: object loop 
Javascript :: is loop backward 
Javascript :: how to compare two strings in javascript if condition 
Javascript :: function javascript 
Javascript :: iterate object in js 
Javascript :: strict equality operator 
Javascript :: material-ui.com autocomplete grouped 
Javascript :: javascript force view to focus on a div 
Javascript :: axios put api in componentDidMount React 
Javascript :: access index of array javascript 
Javascript :: has class in jquery 
Javascript :: inline style to change background color react 
Javascript :: react native cli sdk.dir 
Javascript :: math.floor + roandom 
Javascript :: javascript line chart 
Javascript :: Using redux on react extension 
Javascript :: angular material open last visited tab 
Javascript :: react native bottom sheet above the bottom menu 
Javascript :: how to add attribute in a element 
Javascript :: what are escape characters in javascript 
Javascript :: nodejs SSE 
Javascript :: JavaScript querySelector - By class 
Javascript :: react native login screen 
Javascript :: creating javascript class 
Javascript :: node js classes 
Javascript :: location maps react native 
Javascript :: how to put dynamic image in react 
Javascript :: history react router 
Javascript :: frames[i] javascript 
Javascript :: how to sort an array in js 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =