GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — openqasm/convert2svg.py at main · openqasm/openqasm Expand file tree/ Copy pathconvert2svg.pyMore file actions executable file ·44 lines (33 loc) · 1.17 KB / Copy pathconvert2svg.pyFile metadata and controlsexecutable file ·44 lines (33 loc) · 1.17 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 #!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys import subprocess CONVERT_COMMAND = 'pdftocairo' def main(relative_tex_filepath): if not os.path.exists(relative_tex_filepath): print( 'File %s does not exist.' % relative_tex_filepath, file=sys.stderr) return -1 absolute_tex_filepath = os.path.abspath(relative_tex_filepath) destination_directory = os.path.dirname(absolute_tex_filepath) try: subprocess.run( ['command', '-v', CONVERT_COMMAND]).check_returncode() except subprocess.CalledProcessError: print('Cannot find `%s`. Ensure you it installed and the command is ' 'in the PATH.' % CONVERT_COMMAND, file=sys.stderr) return -1 try: subprocess.run( [CONVERT_COMMAND, '-svg', absolute_tex_filepath], cwd=destination_directory) except subprocess.CalledProcessError: return -1 return 0 if __name__ == '__main__': if len(sys.argv) != 2: print('Usage: convert2svg.py path/to/pdffile.pdf') print('For converting to PDF, use convert2pdf.py first.') sys.exit(-1) sys.exit(main(sys.argv[1])) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |