ios - 将 native html react 为 pdf

标签 ios react-native file pdf html-to-pdf

我正在使用此代码,它在模拟器中运行良好,因为我正在获取位置并且可以从那里获取 pdf 文件

async createPDF() {
    let options = {
     html: '<h1>PDF          TEST</h1>',
      fileName: 'test',
     directory: 'Documents',
  };

   let file = await       RNHTMLtoPDF.convert(options)
   //     console.log(file.filePath);
      alert(file.filePath);
 }
但是上面的代码在真正的 iOS 手机中存在问题,因为它正在将 pdf 文件保存在某处。我不知道在哪里,但我无法在我的手机中看到该文件。那么谁能告诉我如何将我的文件保存在 iOS 中的下载或文档中。这样我就可以看到下载的文件了。

最佳答案

找到了在 base64 字符串中转换文件的答案

关于ios - 将 native html react 为 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67574250/

相关文章:

ios - 如何快速更改代码中的 uitableviews 样式

javascript - 为什么不允许在 React Native 组件属性赋值中展开运算符是一种性能优化?

python - 使用 python 将文件移动到特定目录获取错误文件已存在

windows - 在 Powershell 中删除 file1 中存在于 file2 中的行

ios - Applescript 在 iOS 设备上自动构建和运行

ios - 更改 bool 值时无法在 SwiftUI 中更改按钮文本

ios - 带自变量的惰性属性初始化

xcode - react 原生上不存在 CFBundleIdentifier

react-native - react Native Negative shadowOffset创建顶部阴影

c - 如何将文件中的纯文本解析为二维矩阵/数组?