From 2da66ad7db5a29c809e139abc57f2ef4ad7aae8b Mon Sep 17 00:00:00 2001 From: Brian (bex) Exelbierd Date: Apr 29 2020 08:47:55 +0000 Subject: Update commands for inkscape 1.0 The CLI changed ... Effective in f32 --- diff --git a/fedora_business_cards/export.py b/fedora_business_cards/export.py index afa1f51..1c8f95b 100644 --- a/fedora_business_cards/export.py +++ b/fedora_business_cards/export.py @@ -73,13 +73,13 @@ def svg_to_pdf_png(xmlstring, filename, output_format='png', dpi=300): filename = os.path.join(os.getenv("PWD"), filename) try: if output_format == 'png': - run_command(['inkscape', '-C', '-z', '-d', str(dpi), '-e', + run_command(['inkscape', '-C', '-z', '-d', str(dpi), '-o', filename, svgfilename]) elif output_format == 'pdf': - run_command(['inkscape', '-C', '-z', '-T', '-A', filename, + run_command(['inkscape', '-C', '-z', '-T', '-o', filename, svgfilename]) elif output_format == 'eps': - run_command(['inkscape', '-C', '-z', '-T', '-E', filename, + run_command(['inkscape', '-C', '-z', '-T', '-o', filename, svgfilename]) else: os.remove(svgfilename) @@ -102,10 +102,11 @@ def svg_to_cmyk_pdf(xmlstring, filename, user_height, user_width, user_bleed, """ filename = os.path.join(os.getenv("PWD"), filename) svgfilename = svg_to_file(xmlstring) - args = ['inkscape', '-C', '-z', '-T', '-E', '/dev/stdout', svgfilename] - eps = run_command(args)[0] + args = ['inkscape', '-C', '-z', '-T', '--export-type=eps', svgfilename] + run_command(args)[0] + epsfilename = svgfilename[0:-3] + 'eps' if converter: - eps = eps_cmyk_convert(eps, converter) + eps = eps_cmyk_convert(epsfilename, converter) width = int(math.ceil(convert(user_width + (user_bleed * 2), unit, 'in') * dpi)) height = int(math.ceil(convert(user_height + (user_bleed * 2), unit, 'in') @@ -115,14 +116,15 @@ def svg_to_cmyk_pdf(xmlstring, filename, user_height, user_width, user_bleed, '-sOutputFile=%s' % filename, '-', '-c', 'quit'] run_command(args, eps) + os.remove(epsfilename) os.remove(svgfilename) return True def eps_cmyk_convert(epsdata_in, converter): # first, normalize the output through eps2eps - args = ['eps2eps', '/dev/stdin', '/dev/stdout'] - epsdata = run_command(args, epsdata_in)[0] + args = ['eps2eps', epsdata_in, '/dev/stdout'] + epsdata = run_command(args)[0] epsdata_new = '' # go through each line and check for color commands for line in epsdata.decode().split('\n'):