summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Weller <ianweller@gmail.com>2008-12-14 14:12:18 -0600
committerIan Weller <ianweller@gmail.com>2008-12-14 14:12:18 -0600
commit75f9a781ce5fef4867bcb5e93ab72eb3b95803ca (patch)
tree86f850945e974ad81db518cc76f0648c6ccc7528
parent331a71f8986b8fb21dfd2413e867b13e1186244e (diff)
downloadfedora-business-cards-75f9a781ce5fef4867bcb5e93ab72eb3b95803ca.tar.gz
fedora-business-cards-75f9a781ce5fef4867bcb5e93ab72eb3b95803ca.tar.xz
fedora-business-cards-75f9a781ce5fef4867bcb5e93ab72eb3b95803ca.zip
Add EPS as an export option
-rw-r--r--fedora_business_cards/export.py9
-rw-r--r--fedora_business_cards/frontend/cmdline.py2
2 files changed, 10 insertions, 1 deletions
diff --git a/fedora_business_cards/export.py b/fedora_business_cards/export.py
index baff368..7da871c 100644
--- a/fedora_business_cards/export.py
+++ b/fedora_business_cards/export.py
@@ -39,7 +39,7 @@ def svg_to_pdf_png(xmlstring, filename, format='png', dpi=300):
Export an SVG to either a PDF or PNG.
xmlstring = the SVG XML to export
filename = name of file to save as
- format = either 'png' or 'pdf'
+ format = either 'png', 'pdf', or 'eps'
dpi = DPI to export PNG with (default: 300)
"""
stdin = xmlstring.encode('utf-8')
@@ -55,6 +55,13 @@ def svg_to_pdf_png(xmlstring, filename, format='png', dpi=300):
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
proc.communicate(stdin)
+ elif format == 'eps':
+ command[1] = '-C -z -T -B -d'
+ command[3] = '-E'
+ proc = subprocess.Popen(' '.join(command), shell=True,
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ proc.communicate(stdin)
else:
raise Exception("Invalid file format requested")
return True
diff --git a/fedora_business_cards/frontend/cmdline.py b/fedora_business_cards/frontend/cmdline.py
index 8d1921c..d1d9a65 100644
--- a/fedora_business_cards/frontend/cmdline.py
+++ b/fedora_business_cards/frontend/cmdline.py
@@ -64,6 +64,8 @@ def main():
action="store_const", help="Export as PNG (default)")
parser.add_option("--svg", dest="output", default="png", const="svg",
action="store_const", help="Export as SVG")
+ parser.add_option("--eps", dest="output", default="png", const="eps",
+ action="store_const", help="Export as EPS")
parser.add_option("-c", "--config", dest="config_location", default="",
help="Location of config.ini configuration file")
options = parser.parse_args()[0]