You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thank you so much for coding this, it is helpful. I have installed everything as required (on Ubuntu 20.04) and tried running it on the provided example. However, the svg files with single slides were not converted to pdf, so that of course the merging failed. I realized the error is probably due to the fact that I have inkscape 1.0.1, which presumably changed a little bit the shell interface which is used in the run method in InkscapeWorker to generate the pdf from the single slides.
I have tried to fix it by changing run in the following way, as the same commands seem to work when used directly on the command line. However, that still did not work:
def run(self):
# this is our inkscape worker
self.ink = subprocess.Popen(['inkscape', '--shell'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
# first, wait for inkscape startup
self.wait_for_inkscape()
for svg_file, pdf_file_name, cached in iter(self.queue.get, None):
# main working loop of the inkscape process
# we need to wait for ">" to see whether inkscape is ready.
# The variable ready keeps track of that.
if not cached:
command = "file-open:{0}".format(svg_file)
command2 = "export-filename:{0}".format(pdf_file_name)
command3 = "export-do"
self.ink.stdin.write(command.encode("UTF-8"))
self.ink.stdin.flush()
self.wait_for_inkscape()
self.ink.stdin.write(command2.encode("UTF-8"))
self.ink.stdin.flush()
self.wait_for_inkscape()
self.ink.stdin.write(command3.encode("UTF-8"))
self.ink.stdin.flush()
self.wait_for_inkscape()
print(" Converted {0}".format(pdf_file_name))
else:
print(" Skipping {0}".format(pdf_file_name))
Eventually, I fixed it by not using the subprocess module but instead directly calling a new instance of inkscape for each slide by using os. I realize that is not elegant and not efficient.
def run(self):
import os
for svg_file, pdf_file_name, cached in iter(self.queue.get, None):
# main working loop of the inkscape process
# we need to wait for ">" to see whether inkscape is ready.
# The variable ready keeps track of that.
if not cached:
os.system('inkscape -o "{1}" "{0}"\n'.format(svg_file, pdf_file_name))
print(" Converted {0}".format(pdf_file_name))
else:
print(" Skipping {0}".format(pdf_file_name))
Do you think there is any way to solve this in a better way?
The text was updated successfully, but these errors were encountered:
Hi,
thank you so much for coding this, it is helpful. I have installed everything as required (on Ubuntu 20.04) and tried running it on the provided example. However, the svg files with single slides were not converted to pdf, so that of course the merging failed. I realized the error is probably due to the fact that I have inkscape 1.0.1, which presumably changed a little bit the shell interface which is used in the
run
method inInkscapeWorker
to generate the pdf from the single slides.I have tried to fix it by changing
run
in the following way, as the same commands seem to work when used directly on the command line. However, that still did not work:Eventually, I fixed it by not using the
subprocess
module but instead directly calling a new instance of inkscape for each slide by usingos
. I realize that is not elegant and not efficient.Do you think there is any way to solve this in a better way?
The text was updated successfully, but these errors were encountered: