How to combine html2canvas.js and jspdf.js to watermark web pages converted into pdf? is there any api?

here is my code to convert a web page to pdf through html2canvas.js and jspdf.js
pdf () {

  let that = this
  this.loading = false
  html2Canvas(this.$refs.pictureData).then(canvas => {
  var contentWidth = canvas.width;
  var contentHeight = canvas.height;

  //pdfhtmlcanvas;
  var pageHeight = contentWidth / 592.28 * 841.89;
  //pdfhtml
  var leftHeight = contentHeight;
  //
  var position = 0;
  //a4[595.28,841.89]htmlcanvaspdf
  var imgWidth = 595.28;
  var imgHeight = 592.28/contentWidth * contentHeight;

  var pageData = canvas.toDataURL("image/jpeg", 1.0);
  // -----------------
  console.log("")
  console.log(typeof pageData)
  // -----------------

  var pdf = new jsPDF("", "pt", "a4");

  //htmlpdf(841.89)
  //pdf
  if (leftHeight < pageHeight) {
  pdf.addImage(pageData, "JPEG", 0, 0, imgWidth, imgHeight );
  } else {
      while(leftHeight > 0) {
          pdf.addImage(pageData, "JPEG", 0, position, imgWidth, imgHeight)
          leftHeight -= pageHeight;
          position -= 841.89;
          //
          if(leftHeight > 0) {
            pdf.addPage();
          }
      }
  }

  pdf.save("content.pdf");
  this.loading = true
  });

use canvas to add water printing, ah, drawImage


this should be the download effect, is there a way to directly give a path, and then save the pdf file under that path? I tried to rewrite the source code in jspdf.js, but to no avail


has the landlord found a solution?


add pdf.text before and after pdf.addPage (); (20 pdf.text 20,'Do you like that?'); (ps:20,20 's position is adjusted at will)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9e2b8-4778a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9e2b8-4778a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?