[GRASS-user] Vector drawings in PDF -> converting them

Hamish hamish_b at yahoo.com
Sun Jan 20 17:52:37 EST 2008


> John Tull 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)
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.


Import as vector map-
Translating moveto and lineto commands into coordinates for standard
GRASS ascii format (for v.in.ascii) with a pstoedit plugin would be a
little more work, but fairly trivial. And using their code to make a
v.in.ps module seems feasible too if someone wished to make that.
(then like DXF you'd use v.transform to adjust from XY to map coords)


Certainly converting PDF or PS to another vector format with a
rasterization step degrades the data unnecessarily.


Another tool which could be useful is pdftk. If you uncompress the PDF
with that you get text-editor access to the PostScript within, and then
it's just translating ps draw commands to coordinates.
It's highly useful for other PDF tasks too.
  http://www.pdfhacks.com/pdftk/



Hamish



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 




More information about the grass-user mailing list