Hi,
This is a small SVG file that contains a gray mesh pattern:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg x="0" y="0" width="50" height="40">
<defs>
<pattern id="MASTERPATTERN_0_" width="3.452"
height="3.597" patternUnits="userSpaceOnUse" viewBox="0.001 0.000 3.452
3.597">
<path style="fill:none;stroke:none;" d="
M0.00,0.00 C0.00,0.00 3.45,0.00 3.45,0.00 C3.45,0.00 3.45,3.60 3.45,3.60
C3.45,3.60 0.00,3.60 0.00,3.60 C0.00,3.60 0.00,0.00 0.00,0.00"/>
<path style="fill:none;stroke:none;" d="
M0.00,0.00 C0.00,0.00 3.45,0.00 3.45,0.00 C3.45,0.00 3.45,3.60 3.45,3.60
C3.45,3.60 0.00,3.60 0.00,3.60 C0.00,3.60 0.00,0.00 0.00,0.00"/>
<path
style="fill:none;stroke:#999999;stroke-width:0.409pt;" d=" M0.14,3.15
C0.14,3.15 3.27,0.15 3.27,0.15"/>
<path
style="fill:none;stroke:#999999;stroke-width:0.409pt;" d=" M3.31,3.45
C3.31,3.45 0.17,0.32 0.17,0.32"/>
</pattern>
</defs>
<g>
<pattern id="PATTERN_LINK_0_"
xlink:href="#MASTERPATTERN_0_" patternTransform="matrix(0.54, 0.00,
0.00, -0.54, 97.26, -693.33)">
</pattern>
<path
style="fill:url(#PATTERN_LINK_0_);stroke:#999999;stroke-width:0.540pt;"
d=" M8.19,0.26 C8.19,0.26 0.27,13.21 0.27,24.55 C0.27,24.55 26.55,32.11
33.38,33.38 C40.22,34.63 45.44,38.77 45.44,38.77 C45.44,38.77
47.05,10.14 49.02,7.26 C49.02,7.26 47.24,5.48 29.96,3.32 C12.69,1.16
8.19,0.26 8.19,0.26"/>
</g>
</svg>
I am converting this image to com.lowagie.text.Image with this code:
import java.awt.Graphics2D;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
.
.
.
String uri = new File(svgFile).toURI().toString();
float width = ...
float height = ...
PdfContentByte cb = writer.getDirectContent();
PdfTemplate template = cb.createTemplate(width, height);
java.awt.Graphics2D g2d = template.createGraphics(width,
height);
PrintTranscoder prm = new PrintTranscoder();
TranscoderInput ti = new TranscoderInput(uri);
prm.transcode(ti, null);
PageFormat pg = new PageFormat();
Paper pp = new Paper();
pp.setSize(width, height);
pp.setImageableArea(0, 0, width, height);
pg.setPaper(pp);
prm.print(g2d, pg, 0);
g2d.dispose();
Image image = Image.getInstance(template);
The image retains the color, but not the mesh.
Any suggestions on how get the mesh into the image? Using ImgTemplate
returns the same thing.
------------
Eli Segev
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/