react-nativepdfblobreact-native-pdf

Facing ReactNativeBlobUtil request error in React Native


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]


Solution

  • 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}
                        />