Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
6.3 kB
1
Indexable
Never
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>JTI Career</title>
    <base href="/" />

    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" type="image/x-icon" href="favicon.ico" />

    <!-- CSS Bootstrap -->
    <link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
      integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
      crossorigin="anonymous"
      media="all"
    />

    <!-- JS Bootstrap -->
    <script
      src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
      integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
      crossorigin="anonymous"
    ></script>
    <script
      src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
      integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
      crossorigin="anonymous"
    ></script>
    <script
      src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
      integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
      crossorigin="anonymous"
    ></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
    <script src="assets/js/print.js"></script>
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.3/jspdf.min.js"></script>
    <script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>

    <script>
      function getPDF() {
        $("#downloadbtn").hide();
        $("#genmsg").show();
        var HTML_Width = $(".canvas_div_pdf").width();
        var HTML_Height = $(".canvas_div_pdf").height();
        var top_left_margin = 15;
        var PDF_Width = HTML_Width + top_left_margin * 2;
        var PDF_Height = PDF_Width * 1 + top_left_margin * 2;
        var canvas_image_width = HTML_Width;
        var canvas_image_height = HTML_Height;

        var totalPDFPages = Math.ceil(HTML_Height / PDF_Height) - 1;

        html2canvas($(".canvas_div_pdf")[0], { allowTaint: true }).then(
          function (canvas) {
            canvas.getContext("2d");

            console.log(canvas.height + "  " + canvas.width);

            var imgData = canvas.toDataURL("image/jpeg", 1.0);
            var pdf = new jsPDF("p", "mm", [PDF_Width, PDF_Height]);
            // pdf.addImage(imgData, 'JPG', top_left_margin, top_left_margin,canvas_image_width,canvas_image_height);
            pdf.addImage(
              imgData,
              "PNG",
              top_left_margin,
              top_left_margin,
              canvas_image_width,
              canvas_image_height
            );

            for (var i = 1; i <= totalPDFPages; i++) {
              pdf.addPage([PDF_Width, PDF_Height], "p");
              // pdf.addImage(imgData, 'JPG', top_left_margin, -(PDF_Height*i)+(top_left_margin*4),canvas_image_width,canvas_image_height);
              pdf.addImage(
                imgData,
                "PNG",
                top_left_margin,
                -(PDF_Height * i) + top_left_margin * 4,
                canvas_image_width,
                canvas_image_height
              );
            }

            pdf.save("candidate-name.pdf");

            setTimeout(function () {
              $("#downloadbtn").show();
              $("#genmsg").hide();
            }, 100);
          }
        );
      }
    </script>

    <script>
      function getPDF2() {
        $("#downloadbtn").hide();
        $("#genmsg").show();
        var HTML_Width = $(".canvas_div_pdf").width();
        console.log(HTML_Width);
        var HTML_Height = $(".canvas_div_pdf").height();
        console.log(HTML_Height);
        var top_left_margin = 15;
        var multiplier = 30;
        var PDF_Width = HTML_Width + top_left_margin * 2;
        var PDF_Height = PDF_Width * 1 + top_left_margin * 2;
        console.log(PDF_Width);
        console.log(PDF_Height);
        var canvas_image_width = HTML_Width;
        var canvas_image_height = HTML_Height + multiplier * 12;

        var totalPDFPages = Math.ceil(HTML_Height / PDF_Height) - 1;

        html2canvas($(".canvas_div_pdf")[0], { allowTaint: true }).then(
          function (canvas) {
            canvas.getContext("2d");

            console.log(canvas.height + "  " + canvas.width);

            var imgData = canvas.toDataURL("image/jpeg", 1.0);
            var pdf = new jsPDF("p", "mm", [PDF_Width, PDF_Height]);
            // pdf.addImage(imgData, 'JPG', top_left_margin, top_left_margin,canvas_image_width,canvas_image_height);
            pdf.addImage(
              imgData,
              "PNG",
              top_left_margin,
              top_left_margin,
              canvas_image_width,
              canvas_image_height
            );

            for (var i = 1; i <= totalPDFPages; i++) {
              pdf.addPage([PDF_Width, PDF_Height], "p");
              console.log(i + "-" + PDF_Height + "-" + PDF_Width);
              // pdf.addImage(imgData, 'JPG', top_left_margin, -(PDF_Height*i)+(top_left_margin*4),canvas_image_width,canvas_image_height);
              pdf.addImage(
                imgData,
                "PNG",
                top_left_margin,
                -(PDF_Height * i) + top_left_margin * 4,
                canvas_image_width,
                canvas_image_height
              );
            }

            pdf.save("contract.pdf");

            setTimeout(function () {
              $("#downloadbtn").show();
              $("#genmsg").hide();
            }, 100);
          }
        );
      }
    </script>

    <!-- Angular Material Icon -->
    <link
      href="https://fonts.googleapis.com/icon?family=Material+Icons"
      rel="stylesheet"
    />
    <!--new Font Awsome-->
    <link
      rel="stylesheet"
      href="assets/fontawesome/css/all.min.css"
      as="style"
    />
    <link href="https://cdn.syncfusion.com/ej2/material.css" rel="stylesheet" />
  </head>

  <body>
    <app-root></app-root>
  </body>
</html>