Embedded SVG paths don't get scaled

Open
#327 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

Description

bug

I'm generating an SVG file that links to other SVG files using <image> 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 <image> 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

Dominant language
Python
Stars
959
Forks
172
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Kozea/CairoSVG

All issues in Kozea/CairoSVG

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.