How to use react-native-html-to-pdf - 2 common examples

To help you get started, we’ve selected a few react-native-html-to-pdf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github iotaledger / trinity-wallet / src / mobile / containers / PaperWallet.js View on Github external
}
        
        `,
            fileName: 'paperWallet',
            base64: true,
            fonts: ['iota-wallet-shared-modules/custom-fonts/Inconsolata-Bold.ttf'],
        };

        try {
            this.props.navigator.toggleNavBar({
                to: 'shown',
            });
            if (isAndroid) {
                await RNPrint.printhtml(options.html);
            } else {
                const results = await RNHTMLtoPDF.convert(options);
                await RNPrint.print(results.filePath);
            }
        } catch (err) {
            console.error(err);
        }
    }
github christopherdro / react-native-html-to-pdf / HTMLToPDFExample / index.ios.js View on Github external
componentDidMount() {
    var options = {
      html: '<h1>PDF TEST</h1>',
      fileName: 'test'
    };

  RNHTMLtoPDF.convert(options).then((result) =&gt; {
    RNMail.mail({
        subject: '',
        recipients: [''],
        body: '',
        attachmentPath: result,
        attachmentType: 'pdf',
      }, (error, event) =&gt; {
        if(error) {
          AlertIOS.alert('Error', 'Could not send mail. Please send a mail to support@example.com');
        }
      });
    });
  },

react-native-html-to-pdf

Convert html strings to PDF documents using React Native

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular react-native-html-to-pdf functions