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

Need some feature, and have some question~ #25

Open
szj2ys opened this issue Aug 11, 2024 · 1 comment
Open

Need some feature, and have some question~ #25

szj2ys opened this issue Aug 11, 2024 · 1 comment

Comments

@szj2ys
Copy link

szj2ys commented Aug 11, 2024

  1. Can you tell me how to change the theme?
  2. Do you have plan support latex?
  3. Can you support add local image path?
  4. Can you support direct download picture?
    This is a good project, Thanks!
@TrumanDu
Copy link

TrumanDu commented Dec 7, 2024

the same issue to me.
but I have reaserched example. this is my solution:

 <Md2Poster
              className="!max-w-none"
              theme={theme}
              ref={posterRef}
              size={sizeType}
              aspectRatio={ratioType}
            >

theme :

<option value="SpringGradientWave">SpringGradientWave</option>
              <option value="blue">blue</option>
              <option value="pink">pink</option>
              <option value="purple">purple</option>
              <option value="green">green</option>
              <option value="yellow">yellow</option>
              <option value="gray">gray</option>
              <option value="red">red</option>
              <option value="indigo">indigo</option>

download png

  const downloadImageFromBlob = (blob, filename) => {
    const blobUrl = URL.createObjectURL(blob);

    const a = document.createElement("a");
    a.href = blobUrl;
    a.download = filename;
    document.body.appendChild(a);

    a.click();

    document.body.removeChild(a);
    URL.revokeObjectURL(blobUrl);
  };

  const handleButtonClick = async () => {
    setLoading(true);
    try {
      const blob = await posterRef.current.handleCopy();
      downloadImageFromBlob(blob, "output.png");
    } catch (error) {
      console.error("handleCopy 出错:", error);
    } finally {
      setLoading(false);
    }
  };

more detail see here https://github.com/app-toolkit/m2p/blob/main/src/App.jsx#L63

hope to help you.

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

No branches or pull requests

2 participants