prawn-svg 0.12.0.2 → 0.12.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +7 -3
- data/lib/prawn/svg/document.rb +2 -1
- data/lib/prawn/svg/parser.rb +3 -1
- data/lib/prawn/svg/parser/image.rb +29 -18
- data/lib/prawn/svg/version.rb +1 -1
- data/spec/lib/svg_spec.rb +3 -2
- data/spec/sample_svg/google_charts.svg +181 -0
- data/spec/sample_svg/image01.svg +49 -24
- metadata +4 -2
data/README.md
CHANGED
@@ -16,9 +16,13 @@ Prawn::Document.generate("svg.pdf") do
|
|
16
16
|
end
|
17
17
|
```
|
18
18
|
|
19
|
-
<tt>:at</tt> must be specified.
|
19
|
+
<tt>:at</tt> must be specified.
|
20
|
+
|
21
|
+
<tt>:width</tt>, <tt>:height</tt>, or neither may be specified; if neither is present,
|
20
22
|
the resolution specified in the SVG will be used.
|
21
23
|
|
24
|
+
<tt>:cache_images</tt>, if set to true, will cache images per document based on their URL.
|
25
|
+
|
22
26
|
Supported features
|
23
27
|
------------------
|
24
28
|
|
@@ -46,7 +50,7 @@ prawn-svg is in its infancy and does not support the full SVG specifications. I
|
|
46
50
|
|
47
51
|
- <tt>style</tt> tag, if css_parser gem is installed on the system (see CSS section below)
|
48
52
|
|
49
|
-
- <tt>image</tt> tag, only with http/https schemes
|
53
|
+
- <tt>image</tt> tag, only with http/https schemes; does not support 'slice' preserveAspectRatio
|
50
54
|
|
51
55
|
- attributes/styles: <tt>fill</tt>, <tt>stroke</tt>, <tt>stroke-width</tt>, <tt>opacity</tt>, <tt>fill-opacity</tt>, <tt>stroke-opacity</tt>, <tt>transform</tt>
|
52
56
|
|
@@ -74,7 +78,7 @@ so do not expect too much of it.
|
|
74
78
|
Not supported
|
75
79
|
-------------
|
76
80
|
|
77
|
-
prawn-svg does NOT support external references, measurements in en or em, gradients/patterns or markers.
|
81
|
+
prawn-svg does NOT support external references, measurements in en or em, sub-viewports, gradients/patterns or markers.
|
78
82
|
|
79
83
|
--
|
80
84
|
Copyright Roger Nesbitt <roger@seriousorange.com>. MIT licence.
|
data/lib/prawn/svg/document.rb
CHANGED
@@ -18,7 +18,7 @@ class Prawn::Svg::Document
|
|
18
18
|
attr_accessor :scale
|
19
19
|
|
20
20
|
attr_reader :root,
|
21
|
-
:actual_width, :actual_height, :width, :height, :x_offset, :y_offset,
|
21
|
+
:actual_width, :actual_height, :width, :height, :x_offset, :y_offset, :cache_images,
|
22
22
|
:css_parser
|
23
23
|
|
24
24
|
def initialize(data, bounds, options)
|
@@ -27,6 +27,7 @@ class Prawn::Svg::Document
|
|
27
27
|
@root = REXML::Document.new(data).root
|
28
28
|
@warnings = []
|
29
29
|
@options = options
|
30
|
+
@cache_images = options[:cache_images]
|
30
31
|
@actual_width, @actual_height = bounds # set this first so % width/heights can be used
|
31
32
|
|
32
33
|
if vb = @root.attributes['viewBox']
|
data/lib/prawn/svg/parser.rb
CHANGED
@@ -141,7 +141,7 @@ class Prawn::Svg::Parser
|
|
141
141
|
# ignore
|
142
142
|
do_not_append_calls = true
|
143
143
|
|
144
|
-
when 'font-face'
|
144
|
+
when 'font-face', 'clipPath'
|
145
145
|
# not supported
|
146
146
|
do_not_append_calls = true
|
147
147
|
|
@@ -167,6 +167,8 @@ class Prawn::Svg::Parser
|
|
167
167
|
@document.warnings << e.message
|
168
168
|
end
|
169
169
|
|
170
|
+
element.add_call 'join_style', :bevel
|
171
|
+
|
170
172
|
commands.collect do |command, args|
|
171
173
|
if args && args.length > 0
|
172
174
|
point_to = [x(args[0]), y(args[1])]
|
@@ -14,6 +14,7 @@ class Prawn::Svg::Parser::Image
|
|
14
14
|
|
15
15
|
def initialize(document)
|
16
16
|
@document = document
|
17
|
+
@url_cache = {}
|
17
18
|
end
|
18
19
|
|
19
20
|
def parse(element)
|
@@ -27,7 +28,7 @@ class Prawn::Svg::Parser::Image
|
|
27
28
|
end
|
28
29
|
|
29
30
|
image = begin
|
30
|
-
|
31
|
+
retrieve_data_from_url(url)
|
31
32
|
rescue => e
|
32
33
|
raise Error, "Error retrieving URL #{url}: #{e.message}"
|
33
34
|
end
|
@@ -36,36 +37,38 @@ class Prawn::Svg::Parser::Image
|
|
36
37
|
y = y(attrs['y'] || 0)
|
37
38
|
width = distance(attrs['width'])
|
38
39
|
height = distance(attrs['height'])
|
39
|
-
options = {}
|
40
40
|
|
41
41
|
return if width.zero? || height.zero?
|
42
42
|
raise Error, "width and height must be 0 or higher" if width < 0 || height < 0
|
43
43
|
|
44
44
|
par = (attrs['preserveAspectRatio'] || "xMidYMid meet").strip.split(/\s+/)
|
45
|
-
par.
|
45
|
+
par.shift if par.first == "defer"
|
46
|
+
align, meet_or_slice = par
|
47
|
+
raise Error, "slice preserveAspectRatio not supported by Prawn" if meet_or_slice == "slice"
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
+
options = {}
|
50
|
+
case align
|
51
|
+
when /\Ax(Min|Mid|Max)Y(Min|Mid|Max)\z/
|
52
|
+
options[:fit] = [width, height]
|
49
53
|
ratio = image_ratio(image)
|
50
|
-
if width <
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
if width/height < ratio
|
55
|
+
y -= case $2
|
56
|
+
when "Min" then 0
|
57
|
+
when "Mid" then (height - width/ratio)/2
|
58
|
+
when "Max" then height - width/ratio
|
59
|
+
end
|
56
60
|
else
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
end
|
61
|
+
x += case $1
|
62
|
+
when "Min" then 0
|
63
|
+
when "Mid" then (width - height*ratio)/2
|
64
|
+
when "Max" then width - height*ratio
|
65
|
+
end
|
63
66
|
end
|
64
67
|
when 'none'
|
65
68
|
options[:width] = width
|
66
69
|
options[:height] = height
|
67
70
|
else
|
68
|
-
raise Error, "
|
71
|
+
raise Error, "unknown preserveAspectRatio align keyword; ignoring image"
|
69
72
|
end
|
70
73
|
|
71
74
|
options[:at] = [x, y]
|
@@ -95,6 +98,14 @@ class Prawn::Svg::Parser::Image
|
|
95
98
|
w.to_f / h.to_f
|
96
99
|
end
|
97
100
|
|
101
|
+
def retrieve_data_from_url(url)
|
102
|
+
@url_cache[url] || begin
|
103
|
+
data = open(url).read
|
104
|
+
@url_cache[url] = data if @document.cache_images
|
105
|
+
data
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
98
109
|
%w(x y distance).each do |method|
|
99
110
|
define_method(method) {|*a| @document.send(method, *a)}
|
100
111
|
end
|
data/lib/prawn/svg/version.rb
CHANGED
data/spec/lib/svg_spec.rb
CHANGED
@@ -11,11 +11,12 @@ describe Prawn::Svg::Interface do
|
|
11
11
|
|
12
12
|
files.each do |file|
|
13
13
|
it "renders the #{File.basename file} sample file without warnings or crashing" do
|
14
|
+
warnings = nil
|
14
15
|
Prawn::Document.generate("#{root}/spec/sample_output/#{File.basename file}.pdf") do
|
15
|
-
r = svg IO.read(file), :at => [0, y], :width => 612 - 72
|
16
|
+
r = svg IO.read(file), :at => [0, y], :width => 612 - 72, :cache_images => true
|
16
17
|
warnings = r[:warnings].reject {|w| w =~ /Verdana/ && w =~ /is not a known font/ }
|
17
|
-
warnings.should == []
|
18
18
|
end
|
19
|
+
warnings.should == []
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -0,0 +1,181 @@
|
|
1
|
+
<svg width="944" height="500" style="overflow-x: hidden; overflow-y: hidden;" xmlns="http://www.w3.org/2000/svg" version="1.1">
|
2
|
+
<defs id="defs">
|
3
|
+
<clipPath id="_ABSTRACT_RENDERER_ID_0">
|
4
|
+
<rect x="40" y="40" width="868" height="400"></rect>
|
5
|
+
</clipPath>
|
6
|
+
</defs>
|
7
|
+
<g>
|
8
|
+
<rect x="40" y="40" width="868" height="400" stroke="none" stroke-width="0" fill-opacity="0" fill="#ffffff"></rect>
|
9
|
+
<g clip-path="url(#_ABSTRACT_RENDERER_ID_0)">
|
10
|
+
<g>
|
11
|
+
<rect x="40" y="439" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
12
|
+
<rect x="40" y="382" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
13
|
+
<rect x="40" y="325" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
14
|
+
<rect x="40" y="268" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
15
|
+
<rect x="40" y="211" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
16
|
+
<rect x="40" y="154" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
17
|
+
<rect x="40" y="97" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
18
|
+
<rect x="40" y="40" width="868" height="1" stroke="none" stroke-width="0" fill="#eeeeee"></rect>
|
19
|
+
</g>
|
20
|
+
<g>
|
21
|
+
<g>
|
22
|
+
<path d="M40.5,439.5L40.5,401.5L59.35,420.5L78.2,420.5L97.04,287.5L115.89,363.5L134.74,382.5L153.59,420.5L172.43,401.5L191.28,420.5L210.13,344.5L228.98,97.5L247.83,363.5L266.67,287.5L285.52,363.5L304.37,401.5L323.22,344.5L342.07,420.5L360.91,420.5L379.76,325.5L398.61,363.5L417.46,268.5L436.3,420.5L455.15,363.5L474,420.5L492.85,420.5L511.7,382.5L530.54,401.5L549.39,420.5L568.24,401.5L587.09,382.5L605.93,230.5L624.78,420.5L643.63,382.5L662.48,401.5L681.33,363.5L700.17,382.5L719.02,325.5L737.87,420.5L756.72,420.5L775.57,420.5L794.41,382.5L813.26,268.5L832.11,154.5L850.96,382.5L869.8,382.5L888.65,325.5L907.5,382.5L907.5,439.5Z" stroke="none" stroke-width="0" fill-opacity="0.1" fill="#0088cc"></path>
|
23
|
+
</g>
|
24
|
+
</g>
|
25
|
+
<g>
|
26
|
+
<rect x="40" y="439" width="868" height="1" stroke="none" stroke-width="0" fill="#333333"></rect>
|
27
|
+
</g>
|
28
|
+
<g>
|
29
|
+
<path d="M40.5,401.5L59.35,420.5L78.2,420.5L97.04,287.5L115.89,363.5L134.74,382.5L153.59,420.5L172.43,401.5L191.28,420.5L210.13,344.5L228.98,97.5L247.83,363.5L266.67,287.5L285.52,363.5L304.37,401.5L323.22,344.5L342.07,420.5L360.91,420.5L379.76,325.5L398.61,363.5L417.46,268.5L436.3,420.5L455.15,363.5L474,420.5L492.85,420.5L511.7,382.5L530.54,401.5L549.39,420.5L568.24,401.5L587.09,382.5L605.93,230.5L624.78,420.5L643.63,382.5L662.48,401.5L681.33,363.5L700.17,382.5L719.02,325.5L737.87,420.5L756.72,420.5L775.57,420.5L794.41,382.5L813.26,268.5L832.11,154.5L850.96,382.5L869.8,382.5L888.65,325.5L907.5,382.5" stroke="#0088cc" stroke-width="4" fill-opacity="1" fill="none"></path>
|
30
|
+
</g>
|
31
|
+
</g>
|
32
|
+
<g>
|
33
|
+
<circle cx="40.5" cy="401.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
34
|
+
<circle cx="59.34782608695652" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
35
|
+
<circle cx="78.19565217391305" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
36
|
+
<circle cx="97.04347826086956" cy="287.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
37
|
+
<circle cx="115.8913043478261" cy="363.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
38
|
+
<circle cx="134.73913043478262" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
39
|
+
<circle cx="153.58695652173913" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
40
|
+
<circle cx="172.43478260869566" cy="401.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
41
|
+
<circle cx="191.2826086956522" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
42
|
+
<circle cx="210.13043478260872" cy="344.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
43
|
+
<circle cx="228.97826086956525" cy="97.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
44
|
+
<circle cx="247.82608695652175" cy="363.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
45
|
+
<circle cx="266.67391304347825" cy="287.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
46
|
+
<circle cx="285.5217391304348" cy="363.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
47
|
+
<circle cx="304.3695652173913" cy="401.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
48
|
+
<circle cx="323.21739130434787" cy="344.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
49
|
+
<circle cx="342.0652173913044" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
50
|
+
<circle cx="360.9130434782609" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
51
|
+
<circle cx="379.76086956521743" cy="325.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
52
|
+
<circle cx="398.60869565217394" cy="363.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
53
|
+
<circle cx="417.4565217391305" cy="268.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
54
|
+
<circle cx="436.304347826087" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
55
|
+
<circle cx="455.1521739130435" cy="363.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
56
|
+
<circle cx="474.00000000000006" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
57
|
+
<circle cx="492.84782608695656" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
58
|
+
<circle cx="511.69565217391306" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
59
|
+
<circle cx="530.5434782608696" cy="401.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
60
|
+
<circle cx="549.3913043478261" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
61
|
+
<circle cx="568.2391304347826" cy="401.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
62
|
+
<circle cx="587.0869565217391" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
63
|
+
<circle cx="605.9347826086957" cy="230.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
64
|
+
<circle cx="624.7826086956522" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
65
|
+
<circle cx="643.6304347826087" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
66
|
+
<circle cx="662.4782608695652" cy="401.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
67
|
+
<circle cx="681.3260869565217" cy="363.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
68
|
+
<circle cx="700.1739130434784" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
69
|
+
<circle cx="719.0217391304349" cy="325.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
70
|
+
<circle cx="737.8695652173914" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
71
|
+
<circle cx="756.7173913043479" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
72
|
+
<circle cx="775.5652173913044" cy="420.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
73
|
+
<circle cx="794.413043478261" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
74
|
+
<circle cx="813.2608695652175" cy="268.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
75
|
+
<circle cx="832.108695652174" cy="154.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
76
|
+
<circle cx="850.9565217391305" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
77
|
+
<circle cx="869.804347826087" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
78
|
+
<circle cx="888.6521739130435" cy="325.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
79
|
+
<circle cx="907.5000000000001" cy="382.5" r="5" stroke="none" stroke-width="0" fill="#0088cc"></circle>
|
80
|
+
</g>
|
81
|
+
<g>
|
82
|
+
<g>
|
83
|
+
<text text-anchor="end" x="45.6" y="455.8334591186013" font-size="12" transform="rotate(-30 45.6 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">03/03/12</text>
|
84
|
+
</g>
|
85
|
+
<g>
|
86
|
+
<text text-anchor="end" x="83.29565217391304" y="455.8334591186013" font-size="12" transform="rotate(-30 83.29565217391304 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">05/03/12</text>
|
87
|
+
</g>
|
88
|
+
<g>
|
89
|
+
<text text-anchor="end" x="120.99130434782609" y="455.8334591186013" font-size="12" transform="rotate(-30 120.99130434782609 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">07/03/12</text>
|
90
|
+
</g>
|
91
|
+
<g>
|
92
|
+
<text text-anchor="end" x="158.68695652173912" y="455.8334591186013" font-size="12" transform="rotate(-30 158.68695652173912 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">09/03/12</text>
|
93
|
+
</g>
|
94
|
+
<g>
|
95
|
+
<text text-anchor="end" x="196.38260869565218" y="455.8334591186013" font-size="12" transform="rotate(-30 196.38260869565218 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">11/03/12</text>
|
96
|
+
</g>
|
97
|
+
<g>
|
98
|
+
<text text-anchor="end" x="234.07826086956524" y="455.8334591186013" font-size="12" transform="rotate(-30 234.07826086956524 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">16/03/12</text>
|
99
|
+
</g>
|
100
|
+
<g>
|
101
|
+
<text text-anchor="end" x="271.7739130434783" y="455.8334591186013" font-size="12" transform="rotate(-30 271.7739130434783 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">20/03/12</text>
|
102
|
+
</g>
|
103
|
+
<g>
|
104
|
+
<text text-anchor="end" x="309.46956521739133" y="455.8334591186013" font-size="12" transform="rotate(-30 309.46956521739133 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">22/03/12</text>
|
105
|
+
</g>
|
106
|
+
<g>
|
107
|
+
<text text-anchor="end" x="347.1652173913044" y="455.8334591186013" font-size="12" transform="rotate(-30 347.1652173913044 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">24/03/12</text>
|
108
|
+
</g>
|
109
|
+
<g>
|
110
|
+
<text text-anchor="end" x="384.86086956521746" y="455.8334591186013" font-size="12" transform="rotate(-30 384.86086956521746 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">26/03/12</text>
|
111
|
+
</g>
|
112
|
+
<g>
|
113
|
+
<text text-anchor="end" x="422.5565217391305" y="455.8334591186013" font-size="12" transform="rotate(-30 422.5565217391305 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">28/03/12</text>
|
114
|
+
</g>
|
115
|
+
<g>
|
116
|
+
<text text-anchor="end" x="460.2521739130435" y="455.8334591186013" font-size="12" transform="rotate(-30 460.2521739130435 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">30/03/12</text>
|
117
|
+
</g>
|
118
|
+
<g>
|
119
|
+
<text text-anchor="end" x="497.9478260869566" y="455.8334591186013" font-size="12" transform="rotate(-30 497.9478260869566 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">02/04/12</text>
|
120
|
+
</g>
|
121
|
+
<g>
|
122
|
+
<text text-anchor="end" x="535.6434782608696" y="455.8334591186013" font-size="12" transform="rotate(-30 535.6434782608696 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">04/04/12</text>
|
123
|
+
</g>
|
124
|
+
<g>
|
125
|
+
<text text-anchor="end" x="573.3391304347826" y="455.8334591186013" font-size="12" transform="rotate(-30 573.3391304347826 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">11/04/12</text>
|
126
|
+
</g>
|
127
|
+
<g>
|
128
|
+
<text text-anchor="end" x="611.0347826086958" y="455.8334591186013" font-size="12" transform="rotate(-30 611.0347826086958 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">13/04/12</text>
|
129
|
+
</g>
|
130
|
+
<g>
|
131
|
+
<text text-anchor="end" x="648.7304347826088" y="455.8334591186013" font-size="12" transform="rotate(-30 648.7304347826088 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">16/04/12</text>
|
132
|
+
</g>
|
133
|
+
<g>
|
134
|
+
<text text-anchor="end" x="686.4260869565218" y="455.8334591186013" font-size="12" transform="rotate(-30 686.4260869565218 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">18/04/12</text>
|
135
|
+
</g>
|
136
|
+
<g>
|
137
|
+
<text text-anchor="end" x="724.1217391304349" y="455.8334591186013" font-size="12" transform="rotate(-30 724.1217391304349 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">20/04/12</text>
|
138
|
+
</g>
|
139
|
+
<g>
|
140
|
+
<text text-anchor="end" x="761.8173913043479" y="455.8334591186013" font-size="12" transform="rotate(-30 761.8173913043479 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">22/04/12</text>
|
141
|
+
</g>
|
142
|
+
<g>
|
143
|
+
<text text-anchor="end" x="799.513043478261" y="455.8334591186013" font-size="12" transform="rotate(-30 799.513043478261 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">25/04/12</text>
|
144
|
+
</g>
|
145
|
+
<g>
|
146
|
+
<text text-anchor="end" x="837.208695652174" y="455.8334591186013" font-size="12" transform="rotate(-30 837.208695652174 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">27/04/12</text>
|
147
|
+
</g>
|
148
|
+
<g>
|
149
|
+
<text text-anchor="end" x="874.904347826087" y="455.8334591186013" font-size="12" transform="rotate(-30 874.904347826087 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">01/05/12</text>
|
150
|
+
</g>
|
151
|
+
<g>
|
152
|
+
<text text-anchor="end" x="912.6000000000001" y="455.8334591186013" font-size="12" transform="rotate(-30 912.6000000000001 455.8334591186013)" stroke="none" stroke-width="0" fill="#666666">03/05/12</text>
|
153
|
+
</g>
|
154
|
+
<g>
|
155
|
+
<text text-anchor="end" x="28" y="443.7" font-size="12" stroke="none" stroke-width="0" fill="#666666">0</text>
|
156
|
+
</g>
|
157
|
+
<g>
|
158
|
+
<text text-anchor="end" x="28" y="386.7" font-size="12" stroke="none" stroke-width="0" fill="#666666">3</text>
|
159
|
+
</g>
|
160
|
+
<g>
|
161
|
+
<text text-anchor="end" x="28" y="329.7" font-size="12" stroke="none" stroke-width="0" fill="#666666">6</text>
|
162
|
+
</g>
|
163
|
+
<g>
|
164
|
+
<text text-anchor="end" x="28" y="272.7" font-size="12" stroke="none" stroke-width="0" fill="#666666">9</text>
|
165
|
+
</g>
|
166
|
+
<g>
|
167
|
+
<text text-anchor="end" x="28" y="215.7" font-size="12" stroke="none" stroke-width="0" fill="#666666">12</text>
|
168
|
+
</g>
|
169
|
+
<g>
|
170
|
+
<text text-anchor="end" x="28" y="158.7" font-size="12" stroke="none" stroke-width="0" fill="#666666">15</text>
|
171
|
+
</g>
|
172
|
+
<g>
|
173
|
+
<text text-anchor="end" x="28" y="101.7" font-size="12" stroke="none" stroke-width="0" fill="#666666">18</text>
|
174
|
+
</g>
|
175
|
+
<g>
|
176
|
+
<text text-anchor="end" x="28" y="44.7" stroke-width="0" fill="#666666">21</text>
|
177
|
+
</g>
|
178
|
+
</g>
|
179
|
+
</g>
|
180
|
+
<g></g>
|
181
|
+
</svg>
|
data/spec/sample_svg/image01.svg
CHANGED
@@ -1,39 +1,64 @@
|
|
1
1
|
<?xml version="1.0" standalone="no"?>
|
2
2
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
3
3
|
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
-
<svg width="
|
4
|
+
<svg width="210mm" height="297mm" viewBox="0 0 1050 1485"
|
5
5
|
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
|
6
|
-
<desc>Example rect01 - rectangle with sharp corners</desc>
|
7
|
-
<!-- Show outline of canvas using 'rect' element -->
|
8
|
-
<rect x="1" y="1" width="1198" height="798"
|
9
|
-
fill="none" stroke="blue" stroke-width="2"/>
|
10
6
|
|
11
|
-
<
|
12
|
-
|
7
|
+
<g transform="translate(50 0)">
|
8
|
+
<rect y="50" width="100" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
9
|
+
<image y="50" width="100" height="100" preserveAspectRatio="xMidYMid" xlink:href="http://files.myopera.com/baby2u/albums/423302/smiley-cool.jpg"></image>
|
13
10
|
|
14
|
-
|
15
|
-
|
11
|
+
<rect y="200" width="150" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
12
|
+
<image y="200" width="150" height="100" xlink:href="http://files.myopera.com/baby2u/albums/423302/smiley-cool.jpg"></image>
|
16
13
|
|
17
|
-
|
18
|
-
|
14
|
+
<rect y="350" width="100" height="150" fill="none" stroke="blue" stroke-width="2"/>
|
15
|
+
<image y="350" width="100" height="150" xlink:href="http://files.myopera.com/baby2u/albums/423302/smiley-cool.jpg"></image>
|
19
16
|
|
20
|
-
|
21
|
-
|
17
|
+
<rect y="550" width="150" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
18
|
+
<image y="550" width="150" height="100" preserveAspectRatio="xMinYMin" xlink:href="http://files.myopera.com/baby2u/albums/423302/smiley-cool.jpg"></image>
|
22
19
|
|
23
|
-
|
24
|
-
|
20
|
+
<rect y="700" width="100" height="150" fill="none" stroke="blue" stroke-width="2"/>
|
21
|
+
<image y="700" width="100" height="150" preserveAspectRatio="xMinYMin" xlink:href="http://files.myopera.com/baby2u/albums/423302/smiley-cool.jpg"></image>
|
25
22
|
|
26
|
-
|
27
|
-
|
23
|
+
<rect y="900" width="150" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
24
|
+
<image y="900" width="150" height="100" preserveAspectRatio="xMaxYMax" xlink:href="http://files.myopera.com/baby2u/albums/423302/smiley-cool.jpg"></image>
|
28
25
|
|
29
|
-
|
30
|
-
|
26
|
+
<rect y="1050" width="100" height="150" fill="none" stroke="blue" stroke-width="2"/>
|
27
|
+
<image y="1050" width="100" height="150" preserveAspectRatio="xMaxYMax" xlink:href="http://files.myopera.com/baby2u/albums/423302/smiley-cool.jpg"></image>
|
28
|
+
</g>
|
31
29
|
|
32
|
-
<
|
33
|
-
|
30
|
+
<g transform="translate(250 0)">
|
31
|
+
<rect y="50" width="100" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
32
|
+
<image y="50" width="100" height="100" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
<rect y="200" width="150" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
35
|
+
<image y="200" width="150" height="100" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
37
36
|
|
38
|
-
|
37
|
+
<rect y="350" width="100" height="200" fill="none" stroke="blue" stroke-width="2"/>
|
38
|
+
<image y="350" width="100" height="200" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
39
|
+
|
40
|
+
<rect y="550" width="150" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
41
|
+
<image y="550" width="150" height="100" preserveAspectRatio="xMinYMin" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
42
|
+
|
43
|
+
<rect y="700" width="100" height="200" fill="none" stroke="blue" stroke-width="2"/>
|
44
|
+
<image y="700" width="100" height="200" preserveAspectRatio="xMinYMin" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
45
|
+
|
46
|
+
<rect y="900" width="150" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
47
|
+
<image y="900" width="150" height="100" preserveAspectRatio="xMaxYMax" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
48
|
+
|
49
|
+
<rect y="1050" width="100" height="200" fill="none" stroke="blue" stroke-width="2"/>
|
50
|
+
<image y="1050" width="100" height="200" preserveAspectRatio="xMaxYMax" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
51
|
+
</g>
|
39
52
|
|
53
|
+
<g transform="translate(450 0)">
|
54
|
+
<rect y="50" width="100" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
55
|
+
<image y="50" width="100" height="100" preserveAspectRatio="none" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
56
|
+
|
57
|
+
<rect y="200" width="150" height="100" fill="none" stroke="blue" stroke-width="2"/>
|
58
|
+
<image y="200" width="150" height="100" preserveAspectRatio="none" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
59
|
+
|
60
|
+
<rect y="350" width="100" height="200" fill="none" stroke="blue" stroke-width="2"/>
|
61
|
+
<image y="350" width="100" height="200" preserveAspectRatio="none" xlink:href="http://imalbum.aufeminin.com/album/D20090809/583007_KWWH1ZQ8FU5ATJXSR84C5MRBUWW33L_989174388_H143954_L.jpg"></image>
|
62
|
+
</g>
|
63
|
+
|
64
|
+
</svg>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prawn-svg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.0.
|
4
|
+
version: 0.12.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: prawn
|
@@ -98,6 +98,7 @@ files:
|
|
98
98
|
- spec/sample_svg/cubic01a.svg
|
99
99
|
- spec/sample_svg/cubic02.svg
|
100
100
|
- spec/sample_svg/ellipse01.svg
|
101
|
+
- spec/sample_svg/google_charts.svg
|
101
102
|
- spec/sample_svg/image01.svg
|
102
103
|
- spec/sample_svg/line01.svg
|
103
104
|
- spec/sample_svg/maths.svg
|
@@ -158,6 +159,7 @@ test_files:
|
|
158
159
|
- spec/sample_svg/cubic01a.svg
|
159
160
|
- spec/sample_svg/cubic02.svg
|
160
161
|
- spec/sample_svg/ellipse01.svg
|
162
|
+
- spec/sample_svg/google_charts.svg
|
161
163
|
- spec/sample_svg/image01.svg
|
162
164
|
- spec/sample_svg/line01.svg
|
163
165
|
- spec/sample_svg/maths.svg
|