From 5dc97651bf5830443317196215b8d4a8cc35aa9e Mon Sep 17 00:00:00 2001 From: Aaron Russell Date: Tue, 1 Sep 2020 16:11:08 +0100 Subject: [PATCH 1/6] Added x and y to the type on HTMLOptions --- types/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/index.d.ts b/types/index.d.ts index 812a485b3..827065184 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -198,6 +198,8 @@ declare module "jspdf" { image?: HTMLOptionImage; html2canvas?: Html2CanvasOptions; jsPDF?: jsPDF; + x?: number; + y?: number; } //jsPDF plugin: viewerPreferences From c31095ede683f3bf74230c00e201810ff8c957aa Mon Sep 17 00:00:00 2001 From: Aaron Russell Date: Wed, 2 Sep 2020 10:32:36 +0100 Subject: [PATCH 2/6] Updated documentation for html function --- src/modules/html.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/html.js b/src/modules/html.js index ecece1d5d..fd9fbb6a9 100644 --- a/src/modules/html.js +++ b/src/modules/html.js @@ -969,6 +969,8 @@ import { globalObject } from "../libs/globalObject.js"; * @param {HTMLElement|string} source The source HTMLElement or a string containing HTML. * @param {Object} [options] Collection of settings * @param {function} [options.callback] The mandatory callback-function gets as first parameter the current jsPDF instance + * @param {function} [options.x] x position on the PDF document + * @param {function} [options.y] y position on the PDF document * * @example * var doc = new jsPDF(); @@ -977,6 +979,8 @@ import { globalObject } from "../libs/globalObject.js"; * callback: function (doc) { * doc.save(); * } + * x: 10, + * y: 10 * }); */ jsPDFAPI.html = function(src, options) { From b834d389806edec75df0ac88fb2a93549d94c244 Mon Sep 17 00:00:00 2001 From: Aaron Russell Date: Wed, 2 Sep 2020 10:51:58 +0100 Subject: [PATCH 3/6] Added missing comma --- src/modules/html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/html.js b/src/modules/html.js index fd9fbb6a9..f78795e32 100644 --- a/src/modules/html.js +++ b/src/modules/html.js @@ -978,7 +978,7 @@ import { globalObject } from "../libs/globalObject.js"; * doc.html(document.body, { * callback: function (doc) { * doc.save(); - * } + * }, * x: 10, * y: 10 * }); From 0ff566f6626cbdf593457b28166f22daf79a8be9 Mon Sep 17 00:00:00 2001 From: Aaron Russell Date: Wed, 2 Sep 2020 11:03:31 +0100 Subject: [PATCH 4/6] Added more html parameters to the docs --- src/modules/html.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/html.js b/src/modules/html.js index f78795e32..e9065b3e7 100644 --- a/src/modules/html.js +++ b/src/modules/html.js @@ -969,8 +969,14 @@ import { globalObject } from "../libs/globalObject.js"; * @param {HTMLElement|string} source The source HTMLElement or a string containing HTML. * @param {Object} [options] Collection of settings * @param {function} [options.callback] The mandatory callback-function gets as first parameter the current jsPDF instance - * @param {function} [options.x] x position on the PDF document - * @param {function} [options.y] y position on the PDF document + * @param {number|array} [options.margin] Array of margins [left, bottom, right, top] + * @param {string} [options.filename] name of the file + * @param {boolean} [options.enableLinks] should links work in the HTML when added to the PDF + * @param {HTMLOptionImage} [options.image] image settings when converting HTML to image + * @param {Html2CanvasOptions} [options.html2canvas] html2canvas options + * @param {jsPDF} [options.jsPDF] jsPDF instance + * @param {number} [options.x] x position on the PDF document + * @param {number} [options.y] y position on the PDF document * * @example * var doc = new jsPDF(); From fbc93037b6959cfafe8a656c91d01af9f1f8b127 Mon Sep 17 00:00:00 2001 From: Aaron Russell Date: Wed, 2 Sep 2020 12:51:35 +0100 Subject: [PATCH 5/6] Removed enableLinks option from docs --- src/modules/html.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/modules/html.js b/src/modules/html.js index e9065b3e7..ab1a6ee71 100644 --- a/src/modules/html.js +++ b/src/modules/html.js @@ -971,7 +971,6 @@ import { globalObject } from "../libs/globalObject.js"; * @param {function} [options.callback] The mandatory callback-function gets as first parameter the current jsPDF instance * @param {number|array} [options.margin] Array of margins [left, bottom, right, top] * @param {string} [options.filename] name of the file - * @param {boolean} [options.enableLinks] should links work in the HTML when added to the PDF * @param {HTMLOptionImage} [options.image] image settings when converting HTML to image * @param {Html2CanvasOptions} [options.html2canvas] html2canvas options * @param {jsPDF} [options.jsPDF] jsPDF instance From 2ab898bb93e410191e37a99c70aeb80ae1334998 Mon Sep 17 00:00:00 2001 From: Aaron Russell Date: Wed, 2 Sep 2020 12:52:44 +0100 Subject: [PATCH 6/6] Removed enableLinks and pageBreak from HTMLOptions --- types/index.d.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 827065184..93d62218e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -182,19 +182,10 @@ declare module "jspdf" { quality: number; } - export interface HTMLOptionPageBreak { - mode?: "avoid-all" | "css" | "legacy" | ("avoid-all" | "css" | "legacy")[]; - before?: string; - after?: string; - avoid?: string; - } - export interface HTMLOptions { callback?: (doc: jsPDF) => void; margin?: number | number[]; filename?: string; - enableLinks?: boolean; - pagebreak?: HTMLOptionPageBreak; image?: HTMLOptionImage; html2canvas?: Html2CanvasOptions; jsPDF?: jsPDF;