Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandoc: 'XXX\temp_qiniu.md': openBinaryFile: invalid argument (Invalid argument) #2

Open
hiei17 opened this issue Aug 31, 2019 · 3 comments

Comments

@hiei17
Copy link

hiei17 commented Aug 31, 2019

No description provided.

@juzha
Copy link

juzha commented Apr 23, 2020

Are you using Windows ? I have the same issue. Change ' to " fix the issue for me

@Lodewijk-Eduard
Copy link

which quotation marks are to be changed?

@YSG-79
Copy link

YSG-79 commented Oct 6, 2023

here is the modified code. Note that there are two changes.

The first is "-V CJKmainfont=STSong", due to my system is windows. The second is "cmd = "pandoc "{}" -o "{}" --pdf-engine=xelatex -V CJKmainfont=STSong ".format(md_file, pdf_file)", change the '{}' to \"{}\" and delete the template order(because I don't care about the layout problem).

And I add a few debug code, neglect it. Also there are chinese annotations, I don't want to translate, neglect it again.

`from pathlib import Path
import os

work_dir = Path.cwd()

export_pdf_dir = work_dir / 'pdf'
if not export_pdf_dir.exists():
export_pdf_dir.mkdir()

for md_file in list(work_dir.glob('*.md')):
md_file_name = md_file.name
pdf_file_name = md_file_name.replace('.md', '.pdf')
pdf_file = export_pdf_dir / pdf_file_name
# STSong 或者 "STSong"是有效的,'STSong'是无效的,选择电脑内置的有效字体(通过命令fc-list :lang=zh查看)
cmd = "pandoc\ "{}\" -o\"{}\" --pdf-engine=xelatex -V CJKmainfont=STSong ".format(md_file, pdf_file)
result = os.system(cmd)
# 测试是否成功
if result != 0:
print(f"fail!!")
else:
print(f"success!!")`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants