将ReactNative屏幕/视图导出为PDF

问题描述 投票:0回答:1

我有ReactNative应用。我可以将应用程序的主屏幕/视图保存为PDF或任何其他可打印文件格式吗?

react-native
1个回答
0
投票

@@ React Bala,

使用react-native-view-shot组件。

https://github.com/gre/react-native-view-shot

import RNViewShot from "react-native-view-shot";

RNViewShot.takeSnapshot(viewRef, {
  format: "jpeg",
  quality: 0.8
})
.then(
  uri => console.log("Image saved to", uri),
  error => console.error("Oops, snapshot failed", error)
);

您获得了图像URI之后

https://github.com/Anyline/react-native-image-to-pdf

使用此组件将图像转换为pdf ...

© www.soinside.com 2019 - 2024. All rights reserved.