Kozea / Kozea/CairoSVG

Embedded SVG paths don't get scaled

Open
#327 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
951
Forks
166
PR merge metrics
No merged PRs in 30d

Description

I'm generating an SVG file that links to other SVG files using `` tags. When I view the resulting parent SVG in a browser, things look fine, but when I use CairoSVG to convert it to PDF, the paths inside the child SVG don't get scaled.

Attached are some examples that illustrate the problem. If you look at `japanese.svg`, you see a series of paths (baked from text) on a blue background, filling the viewbox. If you open `assembled.svg` in Firefox or Chrome, you can see that image, referenced via an `` tag, centered and resized.

However, you can see in `assembled.pdf` the result of running `cairosvg ./assembled.svg -o ./assembled.pdf`. The background rectangle is appropriately sized, but the paths are not. (Screenshot below.)
mis-sized paths in properly sized background

I have control over the generation of both the child and the parent files, so if there's some change to the markup I can make which would fix this, please let me know. Otherwise I think this might be a bug.

[embedded-svg-bug.zip](https://github.com/Kozea/CairoSVG/files/6523957/embedded-svg-bug.zip)

Contributor guide

No contributing guide indexed for this repository

Research direction

Unpack embedded-svg-bug.zip and compare japanese.svg, assembled.svg, and assembled.pdf. Reproduce the report with `cairosvg ./assembled.svg -o ./assembled.pdf`, then trace embedded-image rendering from the CairoSVG entry point. Done means paths inside the child SVG scale with its background in the generated PDF.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.