[英]Python pdf2image: hide consoles
I'm using pdf2image
which uses poppler
to convert PDF to images.我正在使用pdf2image
,它使用poppler
将 PDF 转换为图像。 However, when you use it in Python it opens a new console every time to convert a PDF.但是,当您在 Python 中使用它时,它每次转换 PDF 时都会打开一个新控制台。 Is there a way to hide this console?有没有办法隐藏这个控制台?
for file_name in os.listdir(path):
if file_name.endswith('.pdf'):
pages = convert_from_path(path + file_name, thread_count=4)
idx = 1
for page in pages:
page.save(file_name + '-page-' + str(idx) + '.jpg', 'JPEG')
idx += 1
I'm using pdf2image
which uses poppler
to convert PDF to images.我正在使用pdf2image
,它使用poppler
将PDF转换为图像。 However, when you use it in Python it opens a new console every time to convert a PDF.但是,当您在Python中使用它时,它每次都会打开一个新的控制台来转换PDF。 Is there a way to hide this console?有没有办法隐藏此控制台?
for file_name in os.listdir(path):
if file_name.endswith('.pdf'):
pages = convert_from_path(path + file_name, thread_count=4)
idx = 1
for page in pages:
page.save(file_name + '-page-' + str(idx) + '.jpg', 'JPEG')
idx += 1
I'm using pdf2image
which uses poppler
to convert PDF to images.我正在使用pdf2image
,它使用poppler
将PDF转换为图像。 However, when you use it in Python it opens a new console every time to convert a PDF.但是,当您在Python中使用它时,它每次都会打开一个新的控制台来转换PDF。 Is there a way to hide this console?有没有办法隐藏此控制台?
for file_name in os.listdir(path):
if file_name.endswith('.pdf'):
pages = convert_from_path(path + file_name, thread_count=4)
idx = 1
for page in pages:
page.save(file_name + '-page-' + str(idx) + '.jpg', 'JPEG')
idx += 1
currently the code comes by default:目前代码是默认的:
# Spawn the process and save its uuid
startupinfo=None
if platform.system() == 'Windows':
# this startupinfo structure prevents a console window from popping up on Windows
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
processes.append(
(thread_output_file, Popen(args, env=env, stdout=PIPE, stderr=PIPE, startupinfo=startupinfo))
)
I've tried many things and the console keeps popping up我已经尝试了很多东西并且控制台不断弹出
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.