html

jsPDF html PlugIn

Source:

Methods

(inner) html(source, optionsopt)

Source:

Generate a PDF from an HTML element or string using.

Example
var doc = new jsPDF();

doc.html(document.body, {
   callback: function (doc) {
     doc.save();
   },
   x: 10,
   y: 10
});
Parameters:
Name Type Attributes Description
source HTMLElement | string

The source HTMLElement or a string containing HTML.

options Object <optional>

Collection of settings

Properties
Name Type Attributes Description
callback function <optional>

The mandatory callback-function gets as first parameter the current jsPDF instance

margin number | array <optional>

Array of margins [left, bottom, right, top]

filename string <optional>

name of the file

image HTMLOptionImage <optional>

image settings when converting HTML to image

html2canvas Html2CanvasOptions <optional>

html2canvas options

fontFaces Array.<FontFace> <optional>

A list of font-faces to match when resolving fonts. Fonts will be added to the PDF based on the specified URL. If omitted, the font match algorithm falls back to old algorithm.

jsPDF jsPDF <optional>

jsPDF instance

x number <optional>

x position on the PDF document

y number <optional>

y position on the PDF document

Type Definitions

FontFace

Source:
Properties:
Name Type Attributes Description
family string

The name of the font-family.

style string | undefined

The style that this font-face defines, e.g. 'italic'.

weight string | number | undefined

The weight of the font, either as a string or a number (400, 500, 600, e.g.)

stretch string | undefined

The stretch of the font, e.g. condensed, normal, expanded.

src Array.<Object>

A list of URLs from where fonts of various formats can be fetched.

src string <optional>

url A URL to a font of a specific format.

src string <optional>

format Format of the font referenced by the URL.