Expo print isn´t printing an custom html

Environment: “react-native-web”: “~0.11.7”, “expo-print”: “~9.0.1”, “expo”: “~38.0.8”

Expected behaviour: print an pdf passing an “html”

    const htmlContent = `
    <!DOCTYPE html>
    <html lang="en">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Pdf Content</title>
            body {
                font-size: 16px;
                color: rgb(255, 196, 0);
            }            h1 {
                text-align: center;
        <h1>Hello, Unica Exames!</h1>

const createPDF = async (html) => {
    try {
        const { uri } = await Print.printToFileAsync({ html });
        return uri;
    } catch (err) {

export const PrescriptionPage  = ({ navigation }) => {
        <View style={{flex: 1}}>
            <SafeAreaView style={{ flex: 1, width: null, height: null }}>
                <ImageBackground source={backgroundImage} style={styles.backgroundContainer}>
                    <TouchableOpacity style={styles.sideOptionsButton} onPress={() => createPDF(htmlContent)}>
                        <Ionicons name='ios-menu' size={28} color='#ffffff' />
                    <Text style={styles.logoTextStyle}>PrescriptionPage</Text>

What is happening: the function is printing the content of “PrescriptionPage”

In the log the error is showing: TypeError: _await$Print$printToF is undefined

The problem is async await you should create one more constant like loader which will be true untill the data is not fetched
And use that value which will store the data from await after the loader is false

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.