Skip to content

Commit

Permalink
Fix html documentation in typings and JSDoc (#2893)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
aaron-russell committed Sep 3, 2020
1 parent ff854e7 commit 87aa7aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
11 changes: 10 additions & 1 deletion src/modules/html.js
Expand Up @@ -969,14 +969,23 @@ 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 {number|array} [options.margin] Array of margins [left, bottom, right, top]
* @param {string} [options.filename] name of the file
* @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();
*
* doc.html(document.body, {
* callback: function (doc) {
* doc.save();
* }
* },
* x: 10,
* y: 10
* });
*/
jsPDFAPI.html = function(src, options) {
Expand Down
11 changes: 2 additions & 9 deletions types/index.d.ts
Expand Up @@ -182,22 +182,15 @@ 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;
x?: number;
y?: number;
}

//jsPDF plugin: viewerPreferences
Expand Down

0 comments on commit 87aa7aa

Please sign in to comment.