Skip to content
This repository was archived by the owner on Sep 25, 2022. It is now read-only.

The package isn't working in an Angular app #19

Description

@ArturGudiev

I created a new Angular 11 app, installed the package using npm install ng-pdf-make --save, and, having previously imported PdfmakeModule, I used it in the AppComponent.

import {Component, OnInit} from '@angular/core';
import {PdfmakeService} from 'ng-pdf-make';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.sass']
})
export class AppComponent implements OnInit{
  title = 'test-project2';
  option = 'option1';

  constructor(public pdfmake: PdfmakeService) {
  }

  ngOnInit(): void {
    this.pdfmake.create();

    this.pdfmake.configureStyles({ header: { fontSize: 18, bold: true } });

    this.pdfmake.addText('This is a header, using header style', 'header');

    this.pdfmake.addText('This is a header, using a custom style', { fontSize: 16, bold: true });
    this.pdfmake.download();
  }
}

But I got the following error

Error: node_modules/ng-pdf-make/pdfmake/pdfmake.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-pdf-make) which declares PdfmakeModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider
checking with the library's authors to see if the library is expected to be compatible with Ivy.

1 export declare class PdfmakeModule {
~~~~~~~~~~~~~

How can I fix this issue to use the module in a simple Angular 11 app?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions