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

Issue with CSS transform: scale() #642

Closed
hannes123bsi opened this issue Jan 27, 2021 · 4 comments
Closed

Issue with CSS transform: scale() #642

hannes123bsi opened this issue Jan 27, 2021 · 4 comments

Comments

@hannes123bsi
Copy link

Issue in multiple page documents when trying to scale a string.

I'm trying to scale the string "R E C H N U N G ".
On the first 2 pages it is printed overlapped (scaled and non-scaled)
Only on the last page it is printed correctly

You'll see it in the sample file i uploaded.

test.html.txt

Thanks in advance

Hannes Müller

@danfickle
Copy link
Owner

Thanks @hannes123bsi,

It turns out that transforms (scale, rotate, etc) directly on display: inline and inline-block elements are repeating the element, once transformed and once not. Indeed for inline elements the transform property should be ignored altogether.

The "good" news is that transforms work when specified directly on display: block elements including descendants that may be inline, etc.

I was able to boil down the fail-case to the following, which I have committed as a failing test:

<html>
<head>
<style>
@page {
  size: 150px 100px;
  margin: 0;
}
</style>
</head>
<body>
<div><span style="transform: scale(2, 2); display: inline-block;">O N E</span></div>
</body>
</html>

I haven't debugged yet, so don't have a cause for this strange bug.

@MichaelF25
Copy link

I've found a fix: Separate lines for the div Tag:

<html>
<head>
<style>
@page {
  size: 150px 100px;
  margin: 0;
}
</style>
</head>
<body>
<div>
<span style="transform: scale(2, 2); display: inline-block;">O N E</span>
</div>
</body>
</html>

danfickle added a commit that referenced this issue Feb 18, 2021
@danfickle
Copy link
Owner

Thanks @MichaelF25,

I have created PR #653 with a solution. However, I'm still not sure why adding spaces around the span fixes the problem, so I'll do some more investigative work before merging.

danfickle added a commit that referenced this issue Feb 19, 2021
danfickle added a commit that referenced this issue Mar 1, 2021
@MichaelF25
Copy link

Just did a test with v1.0.7 and it seems that the issue is not (completely) resolved. At least the sample which was provided by @hannes123bsi still renders the duplicated text on the first 2 pages (interestingly not on the last page?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants