OiO.lk Blog javascript htm2Pdf Package
javascript

htm2Pdf Package


I have an HTML table below there are some social media icons, by using html2Pdf Package I have converted the table and icons into a PDF, and after the PDF is being generated I am not being redirected to links present inside the image.

const pdfName = `invoice_${formatDate(new Date(), "DDMMYYYY")}.pdf`;
var options = {
  margin: 10,
  filename: pdfName,
  // image: { type: "jpeg", quality: 0.98 },
  html2canvas: {
    scale: 2,
    useCORS: true,
    letterRendering: true,
    allowTaint: true
  },
  jsPDF: {
    unit: "mm",
    format: "a4",
    orientation: "portrait"
  }
};
setTimeout(() => {
  let makepdf = document.getElementById("pdf");
  html2pdf().set(options).from(makepdf).toPdf().save();
}, 1000);
<div id="pdf" className="container mt-3">
  <p className="fs-w600">ORIGINAL FOR RECIPIENTSs</p>
  <table>
    <tr>
      <th className="text-center text-uppercase small font-weight-bold px-1">
        S.No.
      </th>
      <th className="text-center text-uppercase small font-weight-bold">
        Amount in ₹
      </th>
    </tr>
    <tbody>
    </tbody>
  </table>
  <a
    target="_blank"
    className="cursor-pointer text-decoration"
    href={`https://www.facebook.com}
    rel="noreferrer"
  >
    <svg
      xmlns="http://www.w3.org/2000/svg"
      viewBox="0 0 24 24"
      width="20px"
      height="20px"
    >
    </svg>
    {"  "}
  </a>

When the PDF is being rendered I am not able to redirect to the URL in the SVP. When its being clicked how is it being done by using html2pdf or is there any other way?



You need to sign in to view this answers

Exit mobile version