小编psa*_*eys的帖子

如何将图像添加到pdf文件并在React Native Expo中打印

我想在 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)

html react-native

5
推荐指数
1
解决办法
3358
查看次数

标签 统计

html ×1

react-native ×1