|
| 1 | +/** ==================================================================== |
| 2 | + * jsPDF [NAME] plugin |
| 3 | + * Copyright (c) 2012 [YOUR NAME HERE] [WAY TO CONTACT YOU HERE] |
| 4 | + * |
| 5 | + * Permission is hereby granted, free of charge, to any person obtaining |
| 6 | + * a copy of this software and associated documentation files (the |
| 7 | + * "Software"), to deal in the Software without restriction, including |
| 8 | + * without limitation the rights to use, copy, modify, merge, publish, |
| 9 | + * distribute, sublicense, and/or sell copies of the Software, and to |
| 10 | + * permit persons to whom the Software is furnished to do so, subject to |
| 11 | + * the following conditions: |
| 12 | + * |
| 13 | + * The above copyright notice and this permission notice shall be |
| 14 | + * included in all copies or substantial portions of the Software. |
| 15 | + * |
| 16 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 18 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 20 | + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 21 | + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 22 | + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 | + * ==================================================================== |
| 24 | + */ |
| 25 | + |
| 26 | +(function(jsPDFAPI) { |
| 27 | +'use strict' |
| 28 | + |
| 29 | +jsPDFAPI.myFunction = function(args) { |
| 30 | + 'use strict' |
| 31 | + // `this` is _jsPDF object returned when jsPDF is inited (new jsPDF()) |
| 32 | + // `this.internal` is a collection of useful, specific-to-raw-PDF-stream functions. |
| 33 | + // for example, `this.internal.write` function allowing you to write directly to PDF stream. |
| 34 | + // `this.line`, `this.text` etc are available directly. |
| 35 | + // so if your plugin just wraps complex series of this.line or this.text or other public API calls, |
| 36 | + // you don't need to look into `this.internal` |
| 37 | + // See _jsPDF object in jspdf.js for complete list of what's available to you. |
| 38 | + |
| 39 | + |
| 40 | + // it is good practice to return ref to jsPDF instance to make |
| 41 | + // the calls chainable. |
| 42 | + return this |
| 43 | +} |
| 44 | + |
| 45 | +})(jsPDF.API) |
0 commit comments