edisonneza / jspdf-invoice-template

PDF template created to generate invoices based on props object. Using jsPDF library.

Home Page:https://edisonneza.github.io/jspdf-invoice-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular 13 Support

lorenzhh opened this issue · comments

Thanks for this amazing library!

After updating from angular v12 to v13, we started to face this issue:

Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'webpackChunkjsPDFInvoiceTemplate')
TypeError: Cannot read properties of undefined (reading 'webpackChunkjsPDFInvoiceTemplate')

Does it tell much?

Is there any solution?

Hi @lorenzhh,
are you using it by CDN or you have installed using npm?
What version of the library are you using? If not the latest one, please try to update it first.

Let me know for anything.

Regards!

Hi!

I have installed it using npm. It is the latest version 1.3.3

"jspdf-invoice-template": "^1.3.3"

It does work normally with angular 12. After updating the Angular version to 13. This error comes. It is not able to load it at all.

Just by importing it in the component, error occures.

import jsPDFInvoiceTemplate, { OutputType } from 'jspdf-invoice-template';

Way to reproduce:

  1. Generate a new angular app (version 13)

  2. npm install jspdf-invoice-template

  3. In app.component.ts
    import jsPDFInvoiceTemplate, { OutputType } from 'jspdf-invoice-template';

  4. Run the app by ng serve

  5. Open localhost:4200

  6. See console

Hi!!
does the solution found for angular13 support?
getting an error as: Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'webpackChunkjsPDFInvoiceTemplate')
TypeError: Cannot read properties of undefined (reading 'webpackChunkjsPDFInvoiceTemplate')

Hi, I'm using jspdf-invoice-template. I am passing dynamic array from invoice, but it is taking empty.

Hi @tayyab-developer
Can u please paste the code here?
(Or create a new issue)

Hi @edisonneza, thanks again for the great library :) it has been 4 months and I can't still make it work with angular 13.
After upgrading to Angular 13, directly comes the

Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'webpackChunkjsPDFInvoiceTemplate')
TypeError: Cannot read properties of undefined (reading 'webpackChunkjsPDFInvoiceTemplate')

I have seen the new issue regarding angular 13, the issue comes after the new feature of columns width. The types file needs to get updated. Example: header is expected to be string[] which is not correct. It is an Object now.

Were you able to make it work with angular 13? Would you like to share your thoughts?

Hi @lorenzhh, i just updated the package to support Angular v13. I have done a fix by separating the project into two different npm packages, one for web browsers and another one for nodejs.

Please take a look at the readme for more. The version to install for Angular v13 is 1.4.2.

Try it and let me know if anything.

Thank you!

Hi @edisonneza ! Thank you for the quick response!
I confirm, the new version of the library works!

Thank you very much :)