diff options
author | Ian Weller <ianweller@gmail.com> | 2008-12-14 14:12:18 -0600 |
---|---|---|
committer | Ian Weller <ianweller@gmail.com> | 2008-12-14 14:12:18 -0600 |
commit | 75f9a781ce5fef4867bcb5e93ab72eb3b95803ca (patch) | |
tree | 86f850945e974ad81db518cc76f0648c6ccc7528 | |
parent | 331a71f8986b8fb21dfd2413e867b13e1186244e (diff) | |
download | fedora-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.py | 9 | ||||
-rw-r--r-- | fedora_business_cards/frontend/cmdline.py | 2 |
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] |