html2pdf = function html2pdf(src, opt) {
  // Create a new worker with the given options.
  var worker = new html2pdf.Worker(opt);

  if (src) {
    // If src is specified, perform the traditional 'simple' operation.
    return worker.from(src).save();
  } else {
    // Otherwise, return the worker for new Promise-based operation.
    return worker;
  }
}
Generate a PDF from an HTML element or string using html2canvas and jsPDF.

@param {Element|string} source The source element or HTML string.
@param {Object=} opt An object of optional settings: 'margin', 'filename',
   'image' ('type' and 'quality'), and 'html2canvas' / 'jspdf', which are
   sent as settings to their corresponding functions.