更新时间:2023-01-09 20:28:21
安装 wkhtmltopdf 然后从 R 运行以下命令.根据 wkhtmltopdf
在系统上的位置以及输入和输出文件路径和名称,适当更改前三行.
Install wkhtmltopdf and then from R run the following. Change the first three lines as appropriate depending on where wkhtmltopdf
is on your system and depending on the input and output file paths and names.
wkhtmltopdf <- "C:\\Program Files\\wkhtmltopdf\\bin\\wkhtmltopdf.exe"
input <- "in.txt"
output <- "out.pdf"
cmd <- sprintf('"%s" "%s" -o "%s"', wkhtmltopdf, input, output)
shell(cmd)
安装pandoc,根据需要修改下面的前三行并运行.效果如何可能会因您的输入而异.
Install pandoc, modify the first three lines below as needed and run. How well this works may vary depending on your input.
pandoc <- "C:\\Program Files (x86)\\Pandoc\\pandoc.exe"
input <- "in.docx"
output <- "out.pdf"
cmd <- sprintf('"%s" "%s" -o "%s"', pandoc, input, output)
shell(cmd)