How to use expo-print - 10 common examples

To help you get started, we’ve selected a few expo-print 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 expo / expo / apps / native-component-list / src / screens / PrintScreen.tsx View on Github external
_printHTMLLandscapeAsync = async () => {
    return this._printHTMLAsync(Print.Orientation.landscape);
  }
github expo / expo / apps / storybook / stories / APIs / Print.stories.js View on Github external
_printHTMLLandscapeAsync = async () => {
    return this._printHTMLAsync(Print.Orientation.landscape);
  };
github expo / expo / apps / storybook / stories / APIs / Print.stories.js View on Github external
  _printHTMLAsync = async (orientation = Print.Orientation.portrait) => {
    const { selectedPrinter } = this.state;

    try {
      await Print.printAsync({
        html: 'Dear Friend! <b>Happy</b> Birthday, enjoy your day! 🎈',
        printerUrl: selectedPrinter &amp;&amp; selectedPrinter.url,
        orientation,
      });
    } catch (e) {
      Alert.alert('Something went wrong: ', e.message);
    }
  };
github expo / expo / apps / native-component-list / src / screens / PrintScreen.tsx View on Github external
  _printHTMLAsync = async (orientation: string = Print.Orientation.portrait) =&gt; {
    const { selectedPrinter } = this.state;

    try {
      await Print.printAsync({
        html: 'Dear Friend! <b>Happy</b> Birthday, enjoy your day! 🎈',
        printerUrl: selectedPrinter &amp;&amp; selectedPrinter.url,
        orientation,
      });
    } catch (e) {
      Alert.alert('Something went wrong: ', e.message);
    }
  }
github expo / expo / apps / storybook / stories / APIs / Print.stories.js View on Github external
_printDocumentPickerPDFAsync = async () => {
    const { selectedPrinter } = this.state;

    try {
      const document = await DocumentPicker.getDocumentAsync({
        type: 'application/pdf',
      });
      if (document.type !== 'success') {
        throw new Error('User did not select a document');
      }
      await Print.printAsync({
        uri: document.uri,
        printerUrl: selectedPrinter ? selectedPrinter.url : undefined,
      });
    } catch (e) {
      Alert.alert('Something went wrong: ', e.message);
    }
  };
github expo / expo / apps / native-component-list / src / screens / PrintScreen.tsx View on Github external
_printDocumentPickerPDFAsync = async () => {
    const { selectedPrinter } = this.state;

    try {
      const document = await DocumentPicker.getDocumentAsync({
        type: 'application/pdf',
      });
      if (document.type !== 'success') {
        throw new Error('User did not select a document');
      }
      await Print.printAsync({
        uri: document.uri,
        printerUrl: selectedPrinter ? selectedPrinter.url : undefined,
      });
    } catch (e) {
      Alert.alert('Something went wrong: ', e.message);
    }
  }
github expo / expo / apps / native-component-list / src / screens / PrintScreen.tsx View on Github external
_printHTMLToPDF = async () =&gt; {
    try {
      const pdf = await Print.printToFileAsync({
        html: `
          
            
              
            
            
              <h1 style="font-size: 50px; font-family: Helvetica Neue; font-weight: normal;">
                Hello Expo!
              </h1>
              <img style="width: 90vw;" src="https://d30j33t1r58ioz.cloudfront.net/static/guides/sdk.png">
            
          
        `,
      });
github expo / expo / apps / storybook / stories / APIs / Print.stories.js View on Github external
_printHTMLToPDF = async () =&gt; {
    try {
      const pdf = await Print.printToFileAsync({
        html: `
          
            
              <style>
                @page {
                  margin: 20px;
                }
              </style>
            
            
              <h1 style="font-size: 50px; font-family: Helvetica Neue; font-weight: normal;">
                Hello Expo!
              </h1>
              <img style="margin: 20px;" src="https://snack.expo.io/static/expo-logo.png">

expo-print

Provides an API for iOS (AirPrint) and Android printing functionality.

MIT
Latest version published 7 months ago

Package Health Score

85 / 100
Full package analysis