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

Cannot make it work #25

Closed dgma7 closed 6 years ago

dgma7 commented 6 years ago

Hi! Since I update my project, I'm unable to display a pdf. This is the code that it worked. <<<>>>

<StackLayout orientation="vertical" verticalAlignment="center">
         <pdf:PDFView id="pdfViewer" src="{{ src }}" load="{{ onLoad }}"/>
</StackLayout>

<<<< main-page.js >>>> src.set("src", "http://che.org.il/wp-content/uploads/2016/12/pdf-sample.pdf");

but now on 3.0 the view is blank, and I downloaded the plugin demo but I couldn't run it :/

I get this when try to run it:

nativescript-pdf-view@0.0.0-development prepublish /Users/----/Developer/nativescript-pdf-view npm run build

nativescript-pdf-view@0.0.0-development build /Users/----/Developer/nativescript-pdf-view tsc

1 ///


AndroidPdfViewer.d.ts(1,22): error TS6053: File '/Users/----/Developer/nativescript-pdf-view/node_modules/tns-platform-declarations/android.d.ts' not found.

4   export class PDFView extends android.view.SurfaceView {

AndroidPdfViewer.d.ts(4,32): error TS2304: Cannot find name 'android'.

5 fromFile(file: java.io.File): Configurator;


AndroidPdfViewer.d.ts(5,20): error TS2503: Cannot find namespace 'java'.

6     fromUri(uri: android.net.Uri): Configurator;

AndroidPdfViewer.d.ts(6,18): error TS2503: Cannot find namespace 'android'.

11 onError(throwable: java.lang.Throwable): void;


AndroidPdfViewer.d.ts(11,26): error TS2503: Cannot find namespace 'java'.

13     pdfViewRef: WeakRef<PDFViewCommon>,

index.d.ts(13,17): error TS2304: Cannot find name 'WeakRef'.

4 import * as fs from 'tns-core-modules/file-system';


pdf-view.android.ts(4,21): error TS2307: Cannot find module 'tns-core-modules/file-system'.

5 import * as http from 'tns-core-modules/http';

pdf-view.android.ts(5,23): error TS2307: Cannot find module 'tns-core-modules/http'.

14 const pdfViewRef = new WeakRef(this);


pdf-view.android.ts(14,28): error TS2304: Cannot find name 'WeakRef'.

24     return this.nativeView as pdfviewer.PDFView;

pdf-view.android.ts(24,17): error TS2339: Property 'nativeView' does not exist on type 'PDFView'.

28 this.nativeView = value;


pdf-view.android.ts(28,10): error TS2339: Property 'nativeView' does not exist on type 'PDFView'.

33     return new pdfviewer.PDFView(this._context, void 0);

pdf-view.android.ts(33,12): error TS2554: Expected 0 arguments, but got 2.

33 return new pdfviewer.PDFView(this._context, void 0);


pdf-view.android.ts(33,39): error TS2339: Property '_context' does not exist on type 'PDFView'.

56     const uri = android.net.Uri.parse(src);

pdf-view.android.ts(56,17): error TS2663: Cannot find name 'android'. Did you mean the instance member 'this.android'?

1 import * as app from 'tns-core-modules/application';


pdf-view.common.ts(1,22): error TS2307: Cannot find module 'tns-core-modules/application'.

2 import { Property, View } from 'tns-core-modules/ui/core/view';

pdf-view.common.ts(2,32): error TS2307: Cannot find module 'tns-core-modules/ui/core/view'.

3 import * as dialogs from 'tns-core-modules/ui/dialogs';


pdf-view.common.ts(3,26): error TS2307: Cannot find module 'tns-core-modules/ui/dialogs'.

15     pdfViewRef: WeakRef<PDFViewCommon>,

pdf-view.common.ts(15,17): error TS2304: Cannot find name 'WeakRef'.

15 pdfViewRef: WeakRef,


pdf-view.common.ts(15,17): error TS4070: Parameter 'pdfViewRef' of public static method from exported class has or is using private name 'WeakRef'.

1 import { screen } from 'tns-core-modules/platform';

pdf-view.ios.ts(1,24): error TS2307: Cannot find module 'tns-core-modules/platform'.

5 class PDFViewDelegate extends NSObject implements WKNavigationDelegate {


pdf-view.ios.ts(5,31): error TS2552: Cannot find name 'NSObject'. Did you mean 'Object'?

5 class PDFViewDelegate extends NSObject implements WKNavigationDelegate {

pdf-view.ios.ts(5,51): error TS2304: Cannot find name 'WKNavigationDelegate'.

6 public static ObjCProtocols = [WKNavigationDelegate];


pdf-view.ios.ts(6,34): error TS2304: Cannot find name 'WKNavigationDelegate'.

8   private owner: WeakRef<PDFView>;

pdf-view.ios.ts(8,18): error TS2304: Cannot find name 'WeakRef'.

10 public static initWithOwner(owner: WeakRef): PDFViewDelegate {


pdf-view.ios.ts(10,38): error TS2304: Cannot find name 'WeakRef'.

11     const delegate = PDFViewDelegate.new() as PDFViewDelegate;

pdf-view.ios.ts(11,38): error TS2339: Property 'new' does not exist on type 'typeof PDFViewDelegate'.

16 public webViewDidFinishNavigation(webView: WKWebView) {


pdf-view.ios.ts(16,46): error TS2304: Cannot find name 'WKWebView'.

30     return this.nativeView as WKWebView;

pdf-view.ios.ts(30,17): error TS2339: Property 'nativeView' does not exist on type 'PDFView'.

30 return this.nativeView as WKWebView;


pdf-view.ios.ts(30,31): error TS2304: Cannot find name 'WKWebView'.

33   public set ios(value: WKWebView) {

pdf-view.ios.ts(33,25): error TS2304: Cannot find name 'WKWebView'.

33 public set ios(value: WKWebView) {


pdf-view.ios.ts(33,25): error TS4037: Parameter 'ios' of public property setter from exported class has or is using private name 'WKWebView'.

34     this.nativeView = value;

pdf-view.ios.ts(34,10): error TS2339: Property 'nativeView' does not exist on type 'PDFView'.

42 super.onLoaded();


pdf-view.ios.ts(42,11): error TS2339: Property 'onLoaded' does not exist on type 'PDFViewCommon'.

48     super.onUnloaded();

pdf-view.ios.ts(48,11): error TS2339: Property 'onUnloaded' does not exist on type 'PDFViewCommon'.

56 let url: NSURL;


pdf-view.ios.ts(56,14): error TS2304: Cannot find name 'NSURL'.

59       url = NSURL.fileURLWithPath(src);

pdf-view.ios.ts(59,13): error TS2304: Cannot find name 'NSURL'.

62 url = NSURL.URLWithString(src);


pdf-view.ios.ts(62,13): error TS2304: Cannot find name 'NSURL'.

63       const urlRequest = NSURLRequest.requestWithURL(url);

pdf-view.ios.ts(63,26): error TS2304: Cannot find name 'NSURLRequest'.

69 this.delegate = PDFViewDelegate.initWithOwner(new WeakRef(this));


pdf-view.ios.ts(69,55): error TS2304: Cannot find name 'WeakRef'.

71     this.ios = new WKWebView({

pdf-view.ios.ts(71,20): error TS2304: Cannot find name 'WKWebView'.

72 configuration: WKWebViewConfiguration.new(),


pdf-view.ios.ts(72,22): error TS2304: Cannot find name 'WKWebViewConfiguration'.

79       UIViewAutoresizing.FlexibleWidth |

pdf-view.ios.ts(79,7): error TS2304: Cannot find name 'UIViewAutoresizing'.

80 UIViewAutoresizing.FlexibleHeight;


pdf-view.ios.ts(80,7): error TS2304: Cannot find name 'UIViewAutoresizing'.

83   private get mainScreen(): UIScreen {

pdf-view.ios.ts(83,29): error TS2304: Cannot find name 'UIScreen'.

85 return typeof UIScreen.mainScreen === 'function' ?


pdf-view.ios.ts(85,19): error TS2304: Cannot find name 'UIScreen'.

86       UIScreen.mainScreen() as UIScreen :  // xCode 7 and below

pdf-view.ios.ts(86,7): error TS2304: Cannot find name 'UIScreen'.

86 UIScreen.mainScreen() as UIScreen : // xCode 7 and below


pdf-view.ios.ts(86,32): error TS2304: Cannot find name 'UIScreen'.

87       UIScreen.mainScreen;     // xCode 8+

pdf-view.ios.ts(87,7): error TS2304: Cannot find name 'UIScreen'.

1 ///


references.d.ts(1,22): error TS6053: File '/Users/----/Developer/nativescript-pdf-view/node_modules/tns-platform-declarations/ios.d.ts' not found.

2 /// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />

references.d.ts(2,22): error TS6053: File '/Users/----/Developer/nativescript-pdf-view/node_modules/tns-platform-declarations/android.d.ts' not found.

npm ERR! Darwin 16.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build" npm ERR! node v6.11.4 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! nativescript-pdf-view@0.0.0-development build: tsc npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the nativescript-pdf-view@0.0.0-development build script 'tsc'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the nativescript-pdf-view package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! tsc npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs nativescript-pdf-view npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls nativescript-pdf-view npm ERR! There is likely additional logging output above. npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request: npm ERR! /Users/----/Developer/nativescript-pdf-view/npm-debug.log

npm ERR! addLocal Could not install /Users/----/Developer/nativescript-pdf-view npm ERR! Darwin 16.6.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v6.11.4 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE npm ERR! nativescript-pdf-view@0.0.0-development prepublish: npm run build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the nativescript-pdf-view@0.0.0-development prepublish script 'npm run build'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the nativescript-pdf-view package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run build npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs nativescript-pdf-view npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls nativescript-pdf-view npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /Users/----/Developer/nativescript-pdf-view/demo/npm-debug.log Command npm install failed with exit code 1