2 # -*- coding: ISO-8859-1 -*-
5 # Copyright (C) 2003 Jörg Lehmann <joergl@users.sourceforge.net>
7 # epstopng is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # epstopng is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with epstopng; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 from pyx
import dvifile
, canvas
, trafo
, unit
26 progname
= "dvips v0.1: dvi to ps converter based on PyX"
29 def dvips(dviname
, psname
, vshift
="-1 t cm"):
30 fontmap
= dvifile
.readfontmap(["psfonts.map"])
31 df
= dvifile
.dvifile(dviname
, fontmap
=fontmap
)
40 p
= canvas
.page(paperformat
="a4")
41 p
.insert(c
, [trafo
.translate(0, unit
.length(vshift
)+p
.bbox().height())])
48 print "Copyright (C) 2004 Jörg Lehmann <joergl@users.sourceforge.net>"
49 print "usage: dvips [options] <eps-file>"
50 print "-h, --help: show this help"
51 print "-o, --output <file>: output file name (optional)"
56 opts
, args
= getopt
.getopt(sys
.argv
[1:], "ho:", ["help", "output"])
57 except getopt
.GetoptError
:
58 # print help information and exit:
63 if o
in ("-h", "--help"):
66 if o
in ("-o", "--output"):
71 raise RuntimeError("can't handle several input files")
73 raise RuntimeError("must specify an input file (reading from stdin is not yet supported)")
74 if not input.endswith(".dvi"):
75 input = input + ".dvi"
77 output
= input[:-4] + ".ps"
80 def profilefunction(f
):
81 import hotshot
, hotshot
.stats
82 prof
= hotshot
.Profile("test.prof")
85 stats
= hotshot
.stats
.load("test.prof")
87 stats
.sort_stats('time', 'calls')
90 if __name__
== "__main__":
92 # profilefunction(main)