prawn-svg: SVG vector image: arrow-head not displayed
Hi!
The following sample.rb
:
require 'rubygems'
require 'prawn'
require 'prawn-svg'
Prawn::Document.generate("arrows.pdf") do |pdf|
pdf.svg File.read("arrows.svg"), :at => [0, 600], :width => 500
end
does not display the arrow-heads in the SVG image.
Source of the SVG arrows.svg
(for copy-pasting):
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="200"
height="200"
id="svg2"
version="1.1"
inkscape:version="0.48.5 r10040"
sodipodi:docname="New document 1">
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.979899"
inkscape:cx="131.67459"
inkscape:cy="71.158705"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1680"
inkscape:window-height="948"
inkscape:window-x="0"
inkscape:window-y="31"
inkscape:window-maximized="1" />
<defs
id="defs4">
<marker
style="overflow:visible;"
id="Arrow1Lend"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="Arrow1Lend">
<path
transform="scale(0.8) rotate(180) translate(12.5,0)"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path3762" />
</marker>
<marker
style="overflow:visible"
id="Arrow1Lend-3"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow1Lend">
<path
transform="matrix(-0.8,0,0,-0.8,-10,0)"
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt"
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
id="path3762-1"
inkscape:connector-curvature="0" />
</marker>
<marker
style="overflow:visible;"
id="Arrow1LendK"
refX="0.0"
refY="0.0"
orient="auto"
inkscape:stockid="Arrow1LendK">
<path
transform="scale(0.8) rotate(180) translate(12.5,0)"
style="stroke:#ff0000;stroke-width:1.0pt;fill:#ff0000;fill-rule:evenodd"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
id="path4230" />
</marker>
</defs>
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-852.36218)"
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1">
<path
transform="translate(0,852.36218)"
inkscape:connector-curvature="0"
id="path2985"
d="M 26.263966,144.94669 122.22846,94.439059"
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)" />
<path
inkscape:connector-curvature="0"
id="path2985-7"
d="M 40.406101,953.8723 136.3706,903.36467"
style="stroke-linejoin:miter;marker-end:url(#Arrow1LendK);stroke-opacity:1;stroke:#ff0000;stroke-linecap:butt;stroke-width:1px;fill:#ff0000" />
</g>
</svg>
(Issue originally filed at asciidoctor-pdf ref, which uses prawn)
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 33 (19 by maintainers)
Commits related to this issue
- Implement <marker> support This is a full implementation of <marker> except that properties specified on the <marker> or its ancestors are not carried through into the marker when rendering it. This... — committed to mogest/prawn-svg by deleted user 8 years ago
- Handle curves with degenerate control points when drawing markers Curves where the first or second control point was the same as the source or destination point resulted in the incorrect angle being ... — committed to mogest/prawn-svg by deleted user 8 years ago
- Deep duplicate calls when making a copy of the call stack Some prawn methods mutate the arguments passed in to them, so to combot that we need to deep duplicate the arguments whenever we duplicate th... — committed to mogest/prawn-svg by deleted user 8 years ago
I’m working on implementing markers now.