Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align-items center not working #3658

Closed
hamzamushtaq840 opened this issue Oct 19, 2023 · 4 comments · May be fixed by #3659
Closed

align-items center not working #3658

hamzamushtaq840 opened this issue Oct 19, 2023 · 4 comments · May be fixed by #3659

Comments

@hamzamushtaq840
Copy link

hamzamushtaq840 commented Oct 19, 2023

Image and text are not being aligned in center ?

const savePDF = () => {
    var HTML_Width = document.querySelector("#appp").clientWidth;
    var HTML_Height = document.querySelector("#appp").clientHeight;
    var top_left_margin = 0;
    var PDF_Width = HTML_Width + top_left_margin * 2;
    var PDF_Height = PDF_Width * 1.5;
    var canvas_image_width = HTML_Width;
    var canvas_image_height = HTML_Height;
    var totalPDFPages = Math.ceil(HTML_Height / PDF_Height) - 1;

    html2canvas(document.querySelector("#appp"), {
      useCORS: true,
      scale: 1.8
      // allowTaint: true
    }).then(function (canvas) {
      canvas.getContext("2d");

      let img = new Image();
      //@ts-ignore
      img.src = canvas.toDataURL("image/png");
      var pdf = new jsPDF("p", "pt", [PDF_Width, PDF_Height]);
      // var pdf = new jsPDF("p", "pt", [PDF_Width, PDF_Height]);
      pdf.addImage(
        img,
        "JPG",
        top_left_margin,
        top_left_margin,
        canvas_image_width,
        canvas_image_height
      );
      pdf.save("HTML-Document.pdf");
    });
  };

  return (
    <div onClick={() => closeModal()} className="fixed inset-0 flex items-center justify-center z-50 bg-opacity-30 bg-black backdrop-blur-[3px]">
      <button onClick={savePDF}>Generate PDF</button>

      <div id="appp" style={{ width: 800 }} className='bg-white'>
        <div className="flex items-center gap-2">
          <img src={Email} />
          <span>Hello</span>
        </div>
      </div>
    </div>
  )

Screenshot_2

@Mohak973
Copy link

I want to work on it.can u assign it to me?

@jguirimm
Copy link

Bonjour, je souhaite participer à la résolution de ce problème. Pouvez-vous me l'attribuer ?

@shaniqwa-drm
Copy link

this also happens to me with ol list, list-style decimal (numbered list)
in the html it looks good and this is the pdf:
Screenshot 2023-11-28 at 13 54 34

Copy link

This issue is stale because it has been open 90 days with no activity. It will be closed soon. Please comment/reopen if this issue is still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants