diegomura / diegomura/react-pdf

SVG elements are missing interpretation of dx and dy values

Open
#1,271 2 comments 2 reactions 0 assignees View on GitHub
new feature svg
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**
As described in this issue: https://github.com/diegomura/react-pdf/issues/1234 Text, T-Span and Rect elements (maybe others, too) are not considering dx and dy values for relative positioning.

**To Reproduce**
Take this svg i.e.
Each color has a different relative positioning to the parent.
- If the child has a x or y property, it will favour it over the parent property and position itself absolute. In this case dx and dy will be ignore, too.
- If the x or y porperty is missing it will be positioned relative to parent.
- If dx or dy exist, they will be added to the parent

```

```
![image](https://user-images.githubusercontent.com/29654902/116361244-0fe48400-a801-11eb-9cc9-634489e8c9a5.png)

The result of react-pdf has all text elements at position x=10 and y=10:
![image](https://user-images.githubusercontent.com/29654902/116362328-3951df80-a802-11eb-899c-4e1b2c44ebbc.png)

The issue seems only relevant for conversion from existing svgs to react-pdf svg. The above mentioned issue has examples on how to convert from SVG to react-pdf SVG with consideration of parent position.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.