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">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pdf Content</title>
<style>
body {
font-size: 16px;
color: rgb(255, 196, 0);
} h1 {
text-align: center;
}
</style>
</head>
<body>
<h1>Hello, Unica Exames!</h1>
</body>
</html>
`;
const createPDF = async (html) => {
console.log(html);
try {
const { uri } = await Print.printToFileAsync({ html });
console.log(uri);
return uri;
} catch (err) {
console.error(err);
}
};
export const PrescriptionPage = ({ navigation }) => {
return(
<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' />
</TouchableOpacity>
<Text style={styles.logoTextStyle}>PrescriptionPage</Text>
</ImageBackground>
</SafeAreaView>
</View>
);
};
What is happening: the function is printing the content of “PrescriptionPage”
In the log the error is showing: TypeError: _await$Print$printToF is undefined