27

I was facing issue in React Native when using react-native-pdf to display pdf in App

logs displayed in console:

Error: ReactNativeBlobUtil request error: java.lang.IllegalStateException: Use of own trust manager but none definedjava.lang.IllegalStateException: Use of own trust manager but none defined]

1 Answer 1

101

Open Your code and simply use trustAllCerts prop and set its value false

as shown below :

<Pdf
                    trustAllCerts={false}
                      source={{
                        uri: pdfUrl,
                        cache: true,
                      }}
                      onLoadComplete={(numberOfPages, filePath) => {
                        console.log(`Number of pages: ${numberOfPages}`);
                      }}
                      onPageChanged={(page, numberOfPages) => {
                        console.log(`Current page: ${page}`);
                      }}
                      onError={error => {
                        console.log(error);
                      }}
                      onPressLink={uri => {
                        console.log(`Link pressed: ${uri}`);
                      }}
                      style={styles.pdf}
                    />
Sign up to request clarification or add additional context in comments.

1 Comment

Works for me. Thanks. Another point to keep in mind is, if you enclose this <Pdf/> in <SafeAreaView/> it doesn't work!!

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.