eclipsesource / tabris-js

Create native mobile apps in JavaScript or TypeScript.
https://tabrisjs.com
BSD 3-Clause "New" or "Revised" License
1.4k stars 170 forks source link

PdfView load event never fired #2269

Open ishigo1987 opened 1 year ago

ishigo1987 commented 1 year ago

Problem description

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

Expected behavior

load event works as expected

Environment

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 commented 1 year ago

@mpost and @elshadsm some ideas ?

cookieguru commented 1 year ago

Logcat output would be helpful.

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

ishigo1987 commented 1 year ago

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 commented 1 year ago

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

elshadsm commented 1 year ago

@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 commented 1 year ago

Thank you @elshadsm , i will check your solution tomorrow

acefxlabs commented 7 months ago

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