How to use the react-native-html-to-pdf.convert function in react-native-html-to-pdf

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.

github iotaledger / trinity-wallet / src / mobile / containers / PaperWallet.js View on Github external
}
        </style>
        </html>`,
            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) => {
    RNMail.mail({
        subject: '',
        recipients: [''],
        body: '',
        attachmentPath: result,
        attachmentType: 'pdf',
      }, (error, event) => {
        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 10 months ago

Package Health Score

66 / 100
Full package analysis

Popular react-native-html-to-pdf functions