[GRASS-user] Vector drawings in PDF -> converting them
Glynn Clements
glynn at gclements.plus.com
Mon Jan 21 09:51:15 EST 2008
Hamish wrote:
> > > I found this with a search of freshmeat.net. Perhaps it will work,
> > > and free. Let us know.
> > >
> > > http://www.pstoedit.net/
>
> Kurt Heston wrote:
> > Excellent! Works flawlessly. Just a little experimenting yielded
> > this command:
> >
> > pstoedit.exe -f dxf_s:-splineaspolyline roads.pdf roads.dxf
> >
> > Without the "-splineaspolyline" argument the DXF looks just like the
> > other conversions that didn't work.
> >
> > I now have a solution with the right licensing model. Thanks for the
> > suggestion!
>
> (The code is GPL2)
>
>
> Display of PS/EPS in a GRASS monitor-
> looking at src/drvsampl.cpp and drvsampl.h, the primitive commands are
> very close to d.graph's set (which reflects grass's raster graphics
> lib): move to, line to, rectangle, set line color, set fill color, etc.
> so it would probably be fairly simple for someone to write a d.graph
> input file plugin for pstoedit, or incorporate the PS
> reading/sanitizing code to let d.graph render PS files in the xmon.
> (e.g. .eps logo)
Not quite. The PS/PDF moveto/lineto commands construct paths which are
subsequently either stroked or filled, while the GRASS equivalents
automatically stroke the path.
To display PS/PDF vector data using the GRASS display system, you
would need to accumulate the moveto/lineto commands into a buffer,
then either "replay" the data using R_move_abs/R_cont_abs or use it to
construct a polygon to be filled with R_polygon_abs.
In the case of filling, there may be issues with complex areas. PS/PDF
provides a choice of non-zero and even-odd winding rules (fill and
eofill operators respectively), while GRASS only provides even-odd.
> Perhaps wxPython's GUI canvas is able to directly render PS already???
> (no idea) If so this would be a lower priority, but still interesting.
Processing arbitrary PostScript is complex enough that all practical
options involve Ghostscript. This is true whether you're rasterising
or converting to some other vector format.
The latter case normally involves using one of Ghostscript's vector
output drivers, e.g. PCL or PDF, or even the "pswrite" driver (which
outputs relatively "flat" PostScript using a limited set of
operators).
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list