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

Error message on Angular 13

Wollos2019 opened this issue · comments

Property defauft doesn't exit on type 'Props'
var pdfObject = jsPDFInvoiceTemplate.default(props);

Can you provide the code how you have imported it?

First I use the following command to install the package on a Angular project: npm i jspdf-invoice-template.
And this is how I imported it :

import jsPDFInvoiceTemplate, { OutputType, jsPDF } from "jspdf-invoice-template";
var pdfObject = jsPDFInvoiceTemplate.default(props); //returns number of pages created

And 'props' is the object parameter as in the the example i have posted?
The exception you are receiving it's a bit strange.

Can you show a image of the basic implementation with the props parameter? And the error message?

Understand. I have to do some tests for Angular v13 in order to find a fix. Thank you for reporting it!

Exactly, I'm using Angular V13. Thank you for your reply.

You just need to call it that way,

jsPDFInvoiceTemplate(props);
You also may need to add

jsPDFInvoiceTemplate(props as any);

Hi @edisonneza, Thanks for your reply, by using this code jsPDFInvoiceTemplate(props as any);,there is no more error in my InvoiceComponent.ts, but now I'm getting this error in InvoiceComponent.html by launching the App:
Error: Uncaught (in promise): TypeError: Cannot read properties of undefined (reading 'webpackChunkjsPDFInvoiceTemplate')

Hi @Wollos2019 , i just updated the package to support Angular v13. I have done a fix by separating the project into two different 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, I installed the package with npm i jspdf-invoice-template-nodejs, but I get this error:

ERROR Error: Uncaught (in promise): ReferenceError: global is not defined
ReferenceError: global is not defined

Maybe I did something wrong or doesn't know how to implement correctly. I also tried to specified the version like this npm i jspdf-invoice-template-nodejs@1.4.2, but it doesn't work. Thanks a lot for your Attention and your Help.

You are using nodejs package. Please install the "jspdf-invoice-template" if you are using in frontend web projects.

@Wollos2019 I'm closing the issue since the problem seems to be fixed.
Open another one if you have other issues!