From 75f9a781ce5fef4867bcb5e93ab72eb3b95803ca Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Sun, 14 Dec 2008 14:12:18 -0600 Subject: Add EPS as an export option --- fedora_business_cards/export.py | 9 ++++++++- fedora_business_cards/frontend/cmdline.py | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) 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] -- cgit