-
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.
#350 - Much improved sizing support for SVG images.
Including min-width/min-height and border-box sizing. With test.
- Loading branch information
Showing
8 changed files
with
164 additions
and
16 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
Binary file modified
BIN
-36 Bytes
(100%)
openhtmltopdf-examples/src/main/resources/visualtest/expected/replaced-sizing-img.pdf
Binary file not shown.
Binary file added
BIN
+9.01 KB
openhtmltopdf-examples/src/main/resources/visualtest/expected/replaced-sizing-svg.pdf
Binary file not shown.
69 changes: 69 additions & 0 deletions
69
openhtmltopdf-examples/src/main/resources/visualtest/html/replaced-sizing-svg.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,69 @@ | ||
<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 only --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 100px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- height only --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="height: 100px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- min-width --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 100px; min-width: 200px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- min-height --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="height: 100px; min-height: 150px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- max-width --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 400px; max-width: 70px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- max-height --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="height: 400px; max-height: 80px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- border-box --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="padding: 50px; width: 220px; box-sizing: border-box;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- content-box --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="padding: 50px; width: 200px; box-sizing: content-box;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- width and height --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="width: 100px; height: 100px;"> | ||
<rect width="150" height="100" style="fill:rgb(0,0,255);" rx="15" /> | ||
</svg> | ||
|
||
<!-- border-box with different padding values --> | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100" style="padding: 0 10px 20px 40px; width: 220px; box-sizing: border-box;"> | ||
<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
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