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 prefix crashing the rendering #1443

Closed
SvenBecker opened this issue Sep 10, 2021 · 1 comment
Closed

SVG prefix crashing the rendering #1443

SvenBecker opened this issue Sep 10, 2021 · 1 comment
Labels
bug Existing features not working as expected
Milestone

Comments

@SvenBecker
Copy link

I get an error (prefix must not be bound to one of the reserved namespace names) when trying to render an inline svg.

import io

import numpy as np
import weasyprint
from matplotlib.figure import Figure

np.random.seed(7)
data = np.random.randint(0, 1_000, size=(10, 2))

fig = Figure()
ax = fig.add_subplot()
ax.plot(data)

buffer = io.StringIO()
fig.savefig(buffer, format='svg')
img = f"<svg {buffer.getvalue().split('<svg ')[1]}"
html_str = f"""
<html>
  <head></head>
  <body>
    {img}
  </body>
</html>
"""
weasyprint.HTML(string=html_str).write_pdf('example.pdf')
...
WARNING:weasyprint:Ignored `fill:none` at 1:1, unknown property.
WARNING:weasyprint:Ignored `stroke:#000000` at 1:11, unknown property.
WARNING:weasyprint:Ignored `stroke-linecap:square` at 1:26, unknown property.
ERROR:weasyprint:Failed to load inline SVG: prefix must not be bound to one of the reserved namespace names: line 1, column 
@liZe liZe added the crash Problems preventing documents from being rendered label Sep 10, 2021
@liZe liZe closed this as completed in 9a720ac Sep 12, 2021
@liZe
Copy link
Member

liZe commented Sep 12, 2021

Thanks again for the bug report.

@liZe liZe added bug Existing features not working as expected and removed crash Problems preventing documents from being rendered labels Sep 12, 2021
@liZe liZe added this to the 54.0 milestone Sep 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing features not working as expected
Projects
None yet
Development

No branches or pull requests

2 participants