Merott / nativescript-pdf-view

A basic PDF viewer plugin for NativeScript. Now maintained by @madmas: github.com/madmas/nativescript-pdf-view
Other
32 stars 35 forks source link

Can't make it work #1

Closed tomylee001001 closed 8 years ago

tomylee001001 commented 8 years ago

Hi, I'm trying to user your plugin with nativescript-angular when i run my app i am getting:

TypeError: Cannot read property 'barteksc' of undefined File:"<unknown>,line:1,column:265

is there any way to make this plugin work. Thanks.

Merott commented 8 years ago

Hello, Could you please share your package.json.

tomylee001001 commented 8 years ago

this is my package.json

{
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "readme": "NativeScript Application",
  "repository": "<fill-your-repository-here>",
  "nativescript": {
    "id": "org.nativescript.pdfviewer",
    "tns-android": {
      "version": "2.1.1"
    }
  },
  "dependencies": {
    "@angular/common": "2.0.0-rc.3",
    "@angular/compiler": "2.0.0-rc.3",
    "@angular/core": "2.0.0-rc.3",
    "@angular/http": "2.0.0-rc.3",
    "@angular/platform-browser": "2.0.0-rc.3",
    "@angular/platform-browser-dynamic": "2.0.0-rc.3",
    "@angular/platform-server": "2.0.0-rc.3",
    "@angular/router": "3.0.0-alpha.7",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "nativescript-angular": "0.2.0",
    "tns-core-modules": "^2.1.0",
    "nativescript-pdf-view": "latest"
  },
  "devDependencies": {
    "babel-traverse": "6.12.0",
    "babel-types": "6.11.1",
    "babylon": "6.8.4",
    "lazy": "1.0.11",
    "nativescript-dev-typescript": "^0.3.2",
    "typescript": "^1.8.10"
  }
}

Also when i try to run the demo aplication you make i get the following error

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.merott.NativeScriptPDFViewDemo/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: 
Calling js method onCreate failed

Error: Building UI from XML. @file:///app/main-page.xml:6:5
 ���Module '/data/data/com.merott.NativeScriptPDFViewDemo/files/app/nativescript-pdf-view' not found for element 'nativescript-pdf-view:PDFView'.
   ���com.tns.NativeScriptException: Failed to find module with absolute path: "/data/data/com.merott.NativeScriptPDFViewDemo/files/app/nativescript-pdf-view".
      com.tns.Module.resolvePathHelper(Module.java:220)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
    com.tns.Runtime.callJSMethod(Runtime.java:712)
    com.tns.Runtime.callJSMethod(Runtime.java:693)
    com.tns.Runtime.callJSMethod(Runtime.java:683)
    com.tns.NativeScriptAct

thanks.

spstratis commented 8 years ago

Hi, I'm getting a similar error as what's mentioned above.

Error: Building UI from XML. @file:///app/views/eula/eula.xml:13:9
 ���Module '/data/data/org.nativescript.CareGiver/files/app/nativescript-pdf-view' not found for element 'nativescript-pdf-view:PDFView'.
   ���com.tns.NativeScriptException: Failed to find module with absolute path: "/data/data/org.nativescript.CareGiver/files/app/nativescript-pdf-view".
      com.tns.Module.resolvePathHelper(Module.java:220)
    com.tns.Module.resolvePath(Module.java:60)
    com.tns.Runtime.callJSMethodNative(Native Method)
    com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:861)
    com.tns.Runtime.callJSMethodImpl(Runtime.java:726)
    com.tns.Runtime.callJSMethod(Runtime.java:712)
    com.tns.Runtime.callJSMethod(Runtime.java:693)
    com.tns.Runtime.callJSMethod(Runtime.java:683)
    com.tns.gen.android.view.View_OnClickListener.onClick(View_OnClickListener.java:11)
    android.view.View.performClick(View.java:5242)
    android.widget.TextView.performClick(TextView.java:10571)
    android.view.View$PerformClick.run(View.java:21196)
    android.os.Handler.handleCallback(Handler.java:739)
    android.os.Handler.dispatchMessage(Handler.java:95)
    android.os.Looper.loop(Looper.java:145)
    android.app.ActivityThread.main(ActivityThread.java:6938)
    java.lang.reflect.Method.invoke(Native Method)
    java.lang.reflect.Method.invoke(Method.java:372)
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
File: "/data/data/org.nativescript.CareGiver/files/app/tns_modules/ui/builder/builder.js, line: 162, column: 20
Merott commented 8 years ago

I've just released a new version with an updated README.

I've had my own share of issues trying to run this plugin with the latest released versions of the Android runtime and tns-core-modules, which is why the dependencies for these two are set to pre-release versions.

Please take a look at the updated README on how to try out the included demo project for yourself, and if that works for you, try changing your own dependencies to pre-release modules (if possible).

tomylee001001 commented 8 years ago

thanks it work perfectly on android and i am going to test it on ios soon. I hope there will be some functionality in the app so that we can read page by page or by going specific page to resume read. thanks for the plugging.

Merott commented 8 years ago

@tomylee001001 - I'm glad that worked for you.

The iOS implementation is a lot more basic, almost non-existent even, because it's just piggybacking on the iOS UIWebView. So, this should go a lot smoother hopefully.

And about the extra functionality you're looking for, again, this plugin is quite basic. I'll welcome pull requests, but I think I prefer to keep the features in sync on both iOS and Android, or at least have a way of clearly documenting the options available to each platform.

There is also nativescript-pspdfkit, which is a paid option, but probably can offer more features than the basic implementation I've gone for.