You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Graeme Kidd <co...@hotmail.com> on 2009/02/09 02:49:52 UTC

Convert path data to EPS

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



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Convert path data to EPS

Posted by Graeme Kidd <co...@hotmail.com>.
> 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/
Thanks, I was able to use your explanation and examples you gave and use 
them to create a working example.

> 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.
Wow its a small world with an even smaller internet :) Although I am not 
using PDFBox at the moment I hope to in the future so I will be posting 
there shortly with a few more questions.

> BTW, the main mailing list for XML Graphics Commons is
> general@xmlgraphics.apache.org.
Woops sorry about that, I still have some questions about the XML Graphics 
Commons which I will point towards the correct mailing list.

Thanks again for you help

--------------------------------------------------
From: "Jeremias Maerki" <de...@jeremias-maerki.ch>
Sent: Monday, February 09, 2009 7:23 AM
To: <fo...@xmlgraphics.apache.org>
Subject: Re: Convert path data to EPS

> 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
> general@xmlgraphics.apache.org.
>
> 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: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Convert path data to EPS

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
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
general@xmlgraphics.apache.org.

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: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org