Skip to content
Permalink
Browse files

try to add pdftocairo

  • Loading branch information...
wanglongqi committed Jun 20, 2019
1 parent 5043f82 commit 9eed32047b9b76802d80124409359c42f10fcb6b
Showing with 42 additions and 37 deletions.
  1. +37 −36 writetex.inx
  2. +5 −1 writetex.py
@@ -1,36 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>WriteTeX</_name>
<id>tk.whywhow.writetex</id>
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name="preamble" type="string" _gui-text="Preamble File: "></param>
<param name="read-as-line" type="boolean" _gui-text="Trade above as contents">false</param>
<param name="scale" type="float" precision="2" min="0.1" max="50" _gui-text="Scale Factor">1</param>
<param name="action" type="notebook">
<page name="new" _gui-text="New TeX String">
<param name="formula" type="string" _gui-text="LateX Source: "></param>
<param name="rescale" type="boolean" _gui-text="Rescale the node.">false</param>
</page>
<page name="newfile" _gui-text="New from File">
<param name="inputfile" type="string" _gui-text="LateX Source File: "></param>
</page>
<page name="viewold" _gui-text="View Original TeX">
<_param name="old" type="description">Choose this tab if you would like to obtain the original TeX string.</_param>
<param name="tosvg" type="boolean" _gui-text="Write output to Figure"></param>
</page>
<page name="help" _gui-text="Help">
<_param name="help" type="description">You need at least one LaTeX command and one PDFtoSVG command to execute this plugin correctly. Please visit http://writetex.tk for more information. If you have any suggestion, feel free to open an issue in the repository.</_param>
</page>
</param>
<param name="pdftosvg" type="enum" _gui-text="PDF to SVG converter: ">
<_item value="1">PDF2SVG</_item>
<_item value="2">PStoEDIT</_item>
</param>
<param name="latexcmd" type="string" _gui-text="Latex Commnad used to Compile">xelatex</param>
<effect>
<object-type>all</object-type>
</effect>
<script>
<command reldir="extensions" interpreter="python">writetex.py</command>
</script>
</inkscape-extension>
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<_name>WriteTeX</_name>
<id>tk.whywhow.writetex</id>
<dependency type="executable" location="extensions">inkex.py</dependency>
<param name="preamble" type="string" _gui-text="Preamble File: "></param>
<param name="read-as-line" type="boolean" _gui-text="Trade above as contents">false</param>
<param name="scale" type="float" precision="2" min="0.1" max="50" _gui-text="Scale Factor">1</param>
<param name="action" type="notebook">
<page name="new" _gui-text="New TeX String">
<param name="formula" type="string" _gui-text="LateX Source: "></param>
<param name="rescale" type="boolean" _gui-text="Rescale the node.">false</param>
</page>
<page name="newfile" _gui-text="New from File">
<param name="inputfile" type="string" _gui-text="LateX Source File: "></param>
</page>
<page name="viewold" _gui-text="View Original TeX">
<_param name="old" type="description">Choose this tab if you would like to obtain the original TeX string.</_param>
<param name="tosvg" type="boolean" _gui-text="Write output to Figure"></param>
</page>
<page name="help" _gui-text="Help">
<_param name="help" type="description">You need at least one LaTeX command and one PDFtoSVG command to execute this plugin correctly. Please visit http://writetex.tk for more information. If you have any suggestion, feel free to open an issue in the repository.</_param>
</page>
</param>
<param name="pdftosvg" type="enum" _gui-text="PDF to SVG converter: ">
<_item value="1">PDF2SVG</_item>
<_item value="2">PStoEDIT</_item>
<_item value="2">PDFtoCAIRO</_item>
</param>
<param name="latexcmd" type="string" _gui-text="Latex Commnad used to Compile">xelatex</param>
<effect>
<object-type>all</object-type>
</effect>
<script>
<command reldir="extensions" interpreter="python">writetex.py</command>
</script>
</inkscape-extension>
6 writetex.py 100644 → 100755
@@ -170,10 +170,14 @@ def effect(self):
subprocess.call('pdf2svg %s %s' %
(pdf_file, svg_file), shell=True)
self.merge_pdf2svg_svg(svg_file)
else:
elif self.options.pdftosvg == '2':
subprocess.call('pstoedit -f plot-svg "%s" "%s" -dt -ssp -psarg -r9600x9600 > "%s" 2> "%s"'
% (pdf_file, svg_file, out_file, err_file), shell=True)
self.merge_pstoedit_svg(svg_file)
else:
subprocess.call('pdftocairo -svg "%s" "%s" > "%s" 2> "%s"'
% (pdf_file, svg_file, out_file, err_file), shell=True)
self.merge_pdf2svg_svg(svg_file)

os.remove(tex_file)
os.remove(log_file)

0 comments on commit 9eed320

Please sign in to comment.
You can’t perform that action at this time.