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

alignment-baseline attribute does not work #109

Closed
Fadiabb opened this issue Sep 5, 2019 · 2 comments
Closed

alignment-baseline attribute does not work #109

Fadiabb opened this issue Sep 5, 2019 · 2 comments
Labels
enhancement help wanted Help with creating a proper test-case, looking up the spec, or creating a pull request.

Comments

@Fadiabb
Copy link

Fadiabb commented Sep 5, 2019

The attribute alignment-baseline has no effect on the generated pdf.

svg2pdf.js version: 1.4.0
ywork-jspdf version: 2.1.0

To Reproduce

<html>
  <head>
    <script src="../node_modules/jspdf-yworks/dist/jspdf.min.js"></script>
    <script src="../node_modules/svg2pdf.js/dist/svg2pdf.min.js"></script>
  </head>
  <body>
    <script type="text/javascript">
      function downloadpdf() {
        const pdf = new jsPDF("l", "mm", "a3");
        let svg = document.getElementById("svg").firstElementChild;
        svg2pdf(svg, pdf, 0.2);
        pdf.save();
      }
    </script>
    <div id="svg">
        <svg>
            <path
            d="M60,10 L60,110 
            M30,10 L300,10 
            M30,65 L300,65 
            M30,110 L300,110
            "
            stroke="grey"
            />
            <text alignment-baseline="hanging" x="60" y="10">A hanging</text>
            <text alignment-baseline="middle" x="60" y="65">A middle</text>
            <text alignment-baseline="baseline" x="60" y="110">A baseline</text>
        </svg>
    </div>
    <button type="button" onclick="downloadpdf()">download pdf</button>
  </body>
</html>

What we have in Browser:
alignment-baseline

The generate pdf:
alignment-baseline-pdf

@yGuy
Copy link
Member

yGuy commented Sep 5, 2019

See also #80

@yGuy yGuy added enhancement help wanted Help with creating a proper test-case, looking up the spec, or creating a pull request. labels Sep 5, 2019
@yGuy
Copy link
Member

yGuy commented Sep 5, 2019

Thanks for the perfect test-case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted Help with creating a proper test-case, looking up the spec, or creating a pull request.
Projects
None yet
Development

No branches or pull requests

3 participants