Knotes / nativescript-generate-pdf

Generate pdf file with a webview and html.
Apache License 2.0
2 stars 1 forks source link

Issue with new generatePdf() and Angular #1

Open floripabit opened 3 years ago

floripabit commented 3 years ago

I'm trying to use this plugin with the latest {N} 7.0.6 and Angular 10.1.5 but when I try to follow the example I get the following message:

ERROR TypeError: Class constructor Observable cannot be invoked without 'new'

Which platform(s) does your issue occur on?

Currently I've tested only with Android.

Please, provide the following version numbers that your issue occurs with:

{
  "name": "imobit-vistoria",
  "main": "main.js",
  "version": "7.0.2",
  "author": "NativeScript Team <oss@nativescript.org>",
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "publishConfig": {
    "access": "public"
  },
  "keywords": [
    "nativescript",
    "mobile",
    "angular",
    "{N}",
    "template"
  ],
  "repository": "<fill-your-repository-here>",
  "bugs": {
    "url": "https://github.com/NativeScript/NativeScript/issues"
  },
  "scripts": {
    "ngcc": "ngcc --properties es2015 module main --first-only",
    "postinstall": "npm run ngcc"
  },
  "dependencies": {
    "@angular/animations": "~10.1.0",
    "@angular/common": "~10.1.0",
    "@angular/compiler": "~10.1.0",
    "@angular/core": "^10.1.3",
    "@angular/forms": "^10.1.3",
    "@angular/platform-browser": "~10.1.0",
    "@angular/platform-browser-dynamic": "~10.1.0",
    "@angular/router": "~10.1.0",
    "@nativescript/angular": "^10.1.5",
    "@nativescript/core": "^7.0.6",
    "@nativescript/datetimepicker": "^2.0.2",
    "@nativescript/theme": "~2.3.0",
    "@ngx-formly/core": "file:../ngx-formly/dist/@ngx-formly/core",
    "@ngx-formly/nativescript": "file:../ngx-formly/dist/@ngx-formly/nativescript",
    "lodash": "^4.17.20",
    "nativescript-couchbase-plugin": "^0.9.6",
    "nativescript-generate-pdf": "^1.0.0",
    "nativescript-iqkeyboardmanager": "^1.5.1",
    "nativescript-social-share": "^1.6.0",
    "nativescript-ui-dataform": "^7.0.2",
    "nativescript-ui-listview": "^9.0.2",
    "nativescript-ui-sidedrawer": "^9.0.3",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.6.0",
    "zone.js": "~0.11.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~10.1.0",
    "@nativescript/android": "7.0.0",
    "@nativescript/ios": "7.0.0",
    "@nativescript/types": "~7.0.0",
    "@nativescript/webpack": "^3.0.5",
    "@ngtools/webpack": "^10.1.3",
    "node-sass": "^4.14.1",
    "sass-loader": "^10.0.2",
    "typescript": "~3.9.0"
  },
  "private": "true",
  "readme": "NativeScript Application"
}

Please, tell us how to recreate the issue in as much detail as possible.

I've just created a single lazy loaded module that has basically only this function.

Is there any code involved?

Webview: <WebView (loaded)="onWebViewLoaded($event)" #myWebView [src]="webViewSrc"></WebView>

this.webViewSrc = "https://www.facebook.com";
const webView: any = this.myWebView.nativeElement;
// For iOS, use the file path returned by createPdf.
new GeneratePdf().createPdf(webView, 'MyPdfFileName'); // line with error
donny08 commented 3 years ago

@dukewan Any updates on this issue?