Here is the code to handle SVG patterns, it was easier than I thought it
would be. I didn't use any code from Batik or FOP. The hard part is to
implement it without making iText dependent on Batik. The three options
that come to mind are
1) Use reflection,
2) Implementing an extension mechanism (could be implemented similar to
Batik's extension handler,
http://xmlgraphics.apache.org/batik/using/svg-generator.html#Extending+P
aint+object+to+SVG+element+translation),
or 3) Bite the bullet, keep the dependency on Batik, and add native SVG
support to iText.
Let me know what you think.
-Jonathan
// changes to com.lowagie.text.pdf.PdfGraphics2D --
// add to imports
import org.apache.batik.gvt.PatternPaint;
import org.apache.batik.gvt.GraphicsNode;
// add to setPaint() method
else if (paint instanceof PatternPaint) {
PatternPaint pp = (PatternPaint)paint;
Rectangle2D rect = pp.getPatternRect();
PdfPatternPainter pattern =
cb.createPattern((float)rect.getWidth(), (float)rect.getHeight());
Graphics2D g2d =
pattern.createGraphics((float)rect.getWidth(), (float)rect.getHeight());
GraphicsNode gn = pp.getGraphicsNode();
gn.paint(g2d);
g2d.dispose();
if (fill)
cb.setPatternFill(pattern);
else
cb.setPatternStroke(pattern);
}
> ----- Original Message -----
> From: Paulo Soares <[EMAIL PROTECTED]> - 2007-10-08 11:32
> Well, option 1 would be great and as we already have FOP code in iText
> that survived IBM's IP review I suppose that it wouldn't be a problem
to
> get the pattern and shadding implementation.
>
> Paulo=20
-------------------------------------------------------------------------
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/