0

I have ReactNative app. Could I save app's main screen/view in PDF or in any other printable file format?

1 Answer 1

3

@React Bala,

Use react-native-view-shot component.

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)
);

You got image URI After

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

use this component for convert image to pdf...

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you but error is displaying(Im using android tab) [Unhandled promise rejection: TypeError: null is not an object (evaluating '_reactNativeHtmlToPdf.default.convert')]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.