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

SVG is not displayed correctly when adding it to pdfmake pdf #184

Open
EdoardoCroci opened this issue Mar 11, 2024 · 0 comments
Open

SVG is not displayed correctly when adding it to pdfmake pdf #184

EdoardoCroci opened this issue Mar 11, 2024 · 0 comments

Comments

@EdoardoCroci
Copy link

I have a react project with pdfmake added by yarn, a component draws a chart (svg) using d3, I use an id to get the svg.
This is how I get the svg and add it to an empty document:

const svgElement = document.getElementById('svgConcrete');
const svgString = svgElement.outerHTML;

const docDefinition = {
  content: [           
    {
      columns: [
        { width: '*', text: '' },
        {
          svg: svgString,
          width: 175,
          height: 175
        },
        { width: '*', text: '' },
      ]
    }
  ],
}

The image that should be displayed is this:
WhatsApp Image 2024-03-11 at 12 03 04

The image that I get is:
WhatsApp Image 2024-03-11 at 12 05 03

Why does this happen? How can I fix it?

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

1 participant