Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open specific password protected file #860

Open
mastercodebegin opened this issue Aug 19, 2024 · 2 comments
Open

Unable to open specific password protected file #860

mastercodebegin opened this issue Aug 19, 2024 · 2 comments

Comments

@mastercodebegin
Copy link

mastercodebegin commented Aug 19, 2024

What react-native version are you using?
react-native": "0.70.6

What react-native-pdf version are you using?
"react-native-pdf": "^6.7.5"

What platform does your issue occur on? (android/ios/both)
Android(didn't test on iOS)
Describe your issue as precisely as possible :
i'm trying to open password protected bank statement and it's giving me an error although i'm entering valid password but
there is a issue with only icici bank credit card statement password i'm able to open other banks statement they are also password protected and they are being opened properly. i tried icici statement with other app they are opening please check and let me know.
statement link - https://drive.google.com/file/d/1dE_AieY-vYhFHcWx50HWJG-H0x0XIbOT/view?usp=sharing
password is - firo1206

Join a screenshot or video of the problem on the simulator or device?
Screenshot 2024-08-19 at 7 37 22 PM

Show us the code you are using?

 {!visible ?
          <Pdf
            onScaleChanged={(v) => console.log('changed================================', v)
            }
            trustAllCerts={false}
            password={text}
            onPressLink={(uri) => {
              console.log(`Link pressed: ${uri}`);
            }}
            source={{ uri: props.route.params.uri }}
            onError={(error) => {

              PdfPasswordErrorHandler(error)
            }}
            onPageChanged={(page, numberOfPages) => {
              setTotalPage(numberOfPages)
              setCurrentPage(page)
              console.log(`Current page: ${page}${numberOfPages}`);
            }}
            style={styles.pdf} />

          :
          <ModalView
            visible={visible}
            errorRecognize={text}
            errorMessage={errorMsg}
            onText={onChangeText}
            num={num}
            onPressOkay={onPressOkayHandler}
            onPressClose={onPressCloseHandler}
            close={'CLOSE'}
            open={'OPEN'} />
        }
        ```
@mastercodebegin mastercodebegin changed the title Unable to open password protected file Unable to open specific password protected file Aug 24, 2024
@martintan
Copy link

Hey, I was able to try recreating your issue on both iOS and Android, using the example project. However, on both platforms, it is working fine for me.

iOS Android
image image

how I downloaded and passed the password of your PDF file:

let source = require('./4315XXXXXXXX7005_739857_Retail_Amazon_NORM.pdf');
// ...

                    <Pdf ref={(pdf) => {
                        this.pdf = pdf;
                    }}
                         source={source}
                         password="firo1206"
                         scale={this.state.scale}
                         horizontal={this.state.horizontal}

I must note that in order to run this project using latest XCode (15) and Android Studio (Koala), I had to make multiple changes to build configurations, especially on the android project. I tried your issue on both react native 0.69.12 and 0.70.6, it works on both.

I'm guessing your password may have been passed incorrectly (maybe there were spaces?) or something else in your code went wrong. I'd need more information like environment or source code in order to debug and recreate the issue

here's my environment(s):

Environment

  • react-native version: 0.69.12
  • react-native version: 18

iOS

  • OS version: iOS 17.4

Android

  • gradle version: 7.5
  • android gradle plugin version: com.android.tools.build:gradle:7.4.2
  • minSdkVersion: 24
  • compileSdkVersion: 34
  • targetSdkVersion: 34

@mastercodebegin
Copy link
Author

Thanks martin i will try again. i will get back to you if you have time so can we connect if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants