-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
We can now use unit values such as mm in the width/height attribute of SVG images. With tests.
- Loading branch information
Showing
7 changed files
with
183 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+6.44 KB
...htmltopdf-examples/src/main/resources/visualtest/expected/replaced-sizing-svg-non-css.pdf
Binary file not shown.
Binary file modified
BIN
-4 Bytes
(100%)
openhtmltopdf-examples/src/main/resources/visualtest/expected/replaced-sizing-svg.pdf
Binary file not shown.
54 changes: 54 additions & 0 deletions
54
openhtmltopdf-examples/src/main/resources/visualtest/html/replaced-sizing-svg-non-css.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@page { | ||
size: 500px 1500px; | ||
margin: 0; | ||
} | ||
body { | ||
margin: 0; | ||
} | ||
svg { | ||
display: block; | ||
border: 2px solid red; | ||
margin: 2px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<!-- width and height attributes --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" width="100" height="100"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- width and height with units --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" width="4cm" height="4cm"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- fallback to viewBox width and height --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- with no width/height or viewBox fall back to default of 400px square --> | ||
<svg xmlns="http://www.w3.org/2000/svg"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- unless a css width/height is provided --> | ||
<svg xmlns="http://www.w3.org/2000/svg" style="width: 200px; height: 250px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- just a css height --> | ||
<svg xmlns="http://www.w3.org/2000/svg" style="height: 50px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- css properties should take precedence over width/height attributes --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" width="40" height="40" style="width: 100px; min-width: 200px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters