Yes, you can use org.apache.xmlgraphics.java2d.ps.EPSDocumentGraphics2D (a subclass of Graphics2D) to convert the path data to PostScript. The easiest way is to convert the path data you have to java.awt.Shape instances (ex. java.awt.GeneralPath). Those instances can be rendered to EPS using the Graphics2D.draw(Shape) method. Basically, you don't even need to know much about EPS, you just create an EPSDocumentGraphics2D instance and paint against it like you would against a Graphics2D instance obtained from BufferedImage.createGraphics(), for example.
Examples can be found here: http://xmlgraphics.apache.org/commons/postscript.html#java2d http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/examples/java/java2d/ps/ I recognize your name from the PDFBox mailing list, so I guess you already have the path data in Java2D form. That means you only have to set up the EPSDocumentGraphics2D instance as necessary (setting the EPS size), call the right PDFBox paint methods and call the finish() method at the end. HTH BTW, the main mailing list for XML Graphics Commons is [email protected]. On 09.02.2009 02:49:52 Graeme Kidd wrote: > Hi, > If I have some basic path data that creates lines and curves e.g. > Path Data Points := "M363.122 298.53799999999995 L433.787 > 298.53799999999995 C4 > 35.188 305.672 432.181 312.094 421.57599999999996 309.874 > C422.15000000000003 31 > 5.41499999999996 419.024 318.48299999999995 412.53799999999995 > 316.9579999999999 > 7 C412.578 322.74 407.868 328.15500000000003 400.666 326.876 C395.818 > 336.407999 > 99999996 382.49899999999997 337.11 378.70799999999997 324.751 C372.518 > 323.559 3 > 69.51 320.43499999999995 369.85400000000004 312.707 C363.563 315.552 353.399 > 305 > .373 363.122 298.53799999999995 Close Path > > Am I able to convert that to an EPS file using the Apache XML Graphics > Commons? > > Thanks > Jeremias Maerki --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
