Skip to content

Commit 87aa7aa

Browse files
Fix html documentation in typings and JSDoc (#2893)
* Added x and y to the type on HTMLOptions * Updated documentation for html function * Added missing comma * Added more html parameters to the docs * Removed enableLinks option from docs * Removed enableLinks and pageBreak from HTMLOptions
1 parent ff854e7 commit 87aa7aa

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/modules/html.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -969,14 +969,23 @@ import { globalObject } from "../libs/globalObject.js";
969969
* @param {HTMLElement|string} source The source HTMLElement or a string containing HTML.
970970
* @param {Object} [options] Collection of settings
971971
* @param {function} [options.callback] The mandatory callback-function gets as first parameter the current jsPDF instance
972+
* @param {number|array} [options.margin] Array of margins [left, bottom, right, top]
973+
* @param {string} [options.filename] name of the file
974+
* @param {HTMLOptionImage} [options.image] image settings when converting HTML to image
975+
* @param {Html2CanvasOptions} [options.html2canvas] html2canvas options
976+
* @param {jsPDF} [options.jsPDF] jsPDF instance
977+
* @param {number} [options.x] x position on the PDF document
978+
* @param {number} [options.y] y position on the PDF document
972979
*
973980
* @example
974981
* var doc = new jsPDF();
975982
*
976983
* doc.html(document.body, {
977984
* callback: function (doc) {
978985
* doc.save();
979-
* }
986+
* },
987+
* x: 10,
988+
* y: 10
980989
* });
981990
*/
982991
jsPDFAPI.html = function(src, options) {

types/index.d.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -182,22 +182,15 @@ declare module "jspdf" {
182182
quality: number;
183183
}
184184

185-
export interface HTMLOptionPageBreak {
186-
mode?: "avoid-all" | "css" | "legacy" | ("avoid-all" | "css" | "legacy")[];
187-
before?: string;
188-
after?: string;
189-
avoid?: string;
190-
}
191-
192185
export interface HTMLOptions {
193186
callback?: (doc: jsPDF) => void;
194187
margin?: number | number[];
195188
filename?: string;
196-
enableLinks?: boolean;
197-
pagebreak?: HTMLOptionPageBreak;
198189
image?: HTMLOptionImage;
199190
html2canvas?: Html2CanvasOptions;
200191
jsPDF?: jsPDF;
192+
x?: number;
193+
y?: number;
201194
}
202195

203196
//jsPDF plugin: viewerPreferences

0 commit comments

Comments
 (0)