如何解决世博打印不打印自定义html
环境: “ react-native-web”:“〜0.11.7”, “ expo-print”:“〜9.0.1”, “ expo”:“〜38.0.8”
预期行为:打印带有“ html”的pdf
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>
`;
async function createPDF(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>
);
};
发生了什么:该函数正在打印“ PrescriptionPage”的内容
在日志中显示错误:TypeError:_await $ Print $ printToF未定义
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。