我想在 React Native Expo 移动应用程序中打印一个嵌入了 html 图像的 pdf 文件。当我尝试生成 pdf 文件时,生成的 pdf 文件中不包含图像。有关如何将图像包含在我的 pdf 文件中的任何帮助。
createPDF = async (html) => {
try {
const {uri} = await Print.printToFileAsync(html);
Print.printAsync({ uri });
this.setState({callPrint: false});
} catch(err) {
console.error(err);
this.setState({callPrint: false});
}
};
const html = "
<html>
<body>
<div class='title-container'>
<img source="asset/omnix.png" />
</div>
</body>
</html>
";
Run Code Online (Sandbox Code Playgroud)