-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation of proper way to write a plugin #3236
Comments
You're doing it right. You can add methods to the jsPDF API by extending the |
Thanks @HackbrettXXX . The particular thing I'm concerned about is the right way to reference the jsPDF object - I formerly added my method to jsPDF.API, but loading 2.3.1 (using a script tag from a CDN) I found that jsPDF was undefined, and I had to access it as window.jspdf.jsPDF. If someone were using one of the module formats, I assume that would be wrong. I've not yet figured out how to use any of those other module formats (es, node, umd), or how a plugin would be invoked there. |
I think if there were an example plugin (even one that did nothing) in the main repo, that would go a long way. I'd be happy to put a pull request together if I knew that I was doing it right. [edit: when I started writing my plugin, I was looking at an old release. I now see there is such an example, but the way it was invoked didn't work for me. Pull request generated.] |
This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant. |
I've written a plugin for jsPDF, and I've got it working for my test case, but I have zero confidence that it will work for all the situations that jsPDF works. I haven't found documentation on how to properly write a plugin for current jsPDF, and I'd like to do it right.
Currently, I load
2.3.1/jspdf.umd.min.js
before the plugin or the render code, and the plugin does this:What's the proper way to write a plugin, and where is it documented?
The text was updated successfully, but these errors were encountered: