GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — openqasm/convert2svg.py at main · openqasm/openqasm

Expand file tree

/

convert2svg.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
44 lines (33 loc) · 1.17 KB
/

convert2svg.py

Copy path

File metadata and controls

executable file
·
44 lines (33 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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.