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

PdfView load event never fired #2269

Open
ishigo1987 opened this issue Jul 24, 2023 · 7 comments
Open

PdfView load event never fired #2269

ishigo1987 opened this issue Jul 24, 2023 · 7 comments
Labels

Comments

@ishigo1987
Copy link

ishigo1987 commented Jul 24, 2023

Problem description

The pdf content is displayed without problem, but the load event is never fired.
->

Expected behavior

load event works as expected

Environment

  • Tabris.js version: 3.9.0
  • Device: Huawei P10 lite, Xiaomi redmi 10 Pro
  • OS: Android 8 and 12, Ios 16

Code snippet

import{contentView, PdfView, fs} from "tabris";

fs.openFile({

     type: "application/pdf",
     quantity: "single"
  
}).then((result)=>{

  if(result.length > 0){

     new PdfView({

          top: 0,
          left: 0,
          right: 0,
          bottom: 0,
          zoomEnabled: true,
          pageElevation: 2,
          background: "#ffffff",
          spacing: 12,
          src: result[0]
     
      }).onLoad((event)=>{  
     
          console.log(event)
     
      }).appendTo(contentView)
       
  }

});
@ishigo1987 ishigo1987 added the bug label Jul 24, 2023
@ishigo1987
Copy link
Author

@mpost and @elshadsm some ideas ?

@cookieguru
Copy link
Contributor

cookieguru commented Jul 25, 2023

Logcat output would be helpful.

Also: have you granted the storage permission for the app?

@ishigo1987
Copy link
Author

Yep i've granted the storage permission.

I don't think logcat will be very helpful because the problem exist on Ios too and with the Tabris developer app.

@elshadsm
Copy link
Contributor

@ishigo1987, thank you for reporting the issue.
We will figure it out.

@elshadsm
Copy link
Contributor

@ishigo1987, to fix the issue, you can simply update the src property after constructing the PdfView widget. Here's the updated snippet:

const pdfView = new PdfView({
  top: 0,
  left: 0,
  right: 0,
  bottom: 0,
  zoomEnabled: true,
  pageElevation: 2,
  background: "#ffffff",
  spacing: 12
}).onLoad((event) => {
  console.log(event)
}).appendTo(contentView)
pdfView.src = result[0];

@ishigo1987
Copy link
Author

Thank you @elshadsm , i will check your solution tomorrow

@acefxlabs
Copy link

@ishigo1987 Did the solution work
If yes can you close this issue

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

No branches or pull requests

4 participants